Hi -
I have written the following code to try and create a toggle each time the code is executed for conditional formatting. I am running into an error and have tried a few different variations of this code. Any advice is greatly appreciated.
Sub change_alternateshading()
Select Case Selection.FormatConditions.Add Type:=xlExpression
Case "=MOD(ROW(),2)"
Selection.FormatConditions.Delete
Case Else
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=MOD(ROW(),2)"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = -4.99893185216834E-02
End With
Selection.FormatConditions(1).StopIfTrue = False
End Select
End Sub
Thanks!
I have written the following code to try and create a toggle each time the code is executed for conditional formatting. I am running into an error and have tried a few different variations of this code. Any advice is greatly appreciated.
Sub change_alternateshading()
Select Case Selection.FormatConditions.Add Type:=xlExpression
Case "=MOD(ROW(),2)"
Selection.FormatConditions.Delete
Case Else
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=MOD(ROW(),2)"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = -4.99893185216834E-02
End With
Selection.FormatConditions(1).StopIfTrue = False
End Select
End Sub
Thanks!