This should be DirtyCellsButton(TRUE)
Sub DirtyCellsButtonON()
If ActiveSheet.Shapes.Range(Array("shpDirtCellsSave")).Fill.ForeColor.RGB = RGB(192, 0, 0) Then Exit Sub
'need to NOT select the shape. I think remove 'ShapeRange'?
'workround
Dim rngCell As Range
Set rngCell = ActiveCell
ActiveSheet.Shapes.Range(Array("shpDirtCellsSave")).Select
With Selection.ShapeRange.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(192, 0, 0)
.Transparency = 0
.Solid
End With
With Selection.ShapeRange.Line
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorBackground1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0
.Transparency = 0
End With
Selection.ShapeRange.Line.Visible = msoFalse
With Selection.ShapeRange.TextFrame2.TextRange.Font.Fill
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorBackground1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0
.Transparency = 0
.Solid
End With
rngCell.Select
End Sub
Sub DirtyCellsButtonOFF()
ActiveSheet.Shapes.Range(Array("shpDirtCellsSave")).Select
With Selection.ShapeRange.Fill
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorBackground1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0
.Transparency = 0
.Solid
End With
With Selection.ShapeRange.Line
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorBackground1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = -0.150000006
.Transparency = 0
End With
With Selection.ShapeRange.TextFrame2.TextRange.Font.Fill
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorBackground1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = -0.150000006
.Transparency = 0
.Solid
End With
End Sub
Improvements:
- Should not need to Select the Button.
- Should be DirtyCellsButton(TRUE)
- Colors should be driven by a Swatches sheet