J
Jock
Hi,
can anybody tell me why the following code fails at FormatConditions.Add
Private Sub CommandButton1_Click()
Dim Sh As Worksheet
Dim lngLastRow As Long
Set Sh = ActiveWorkbook.ActiveSheet
lngLastRow = Sh.Cells(Cells.Rows.Count, "A").End(xlUp).Row
Range("A4:E" & lngLastRow).Activate
Selection.FormatConditions.Add Type:=xlExpression,
Formula1:="=(MOD(ROW(),2)=0"
Selection.FormatConditions(1).Interior.ColorIndex = 24
End Sub
Thanks
can anybody tell me why the following code fails at FormatConditions.Add
Private Sub CommandButton1_Click()
Dim Sh As Worksheet
Dim lngLastRow As Long
Set Sh = ActiveWorkbook.ActiveSheet
lngLastRow = Sh.Cells(Cells.Rows.Count, "A").End(xlUp).Row
Range("A4:E" & lngLastRow).Activate
Selection.FormatConditions.Add Type:=xlExpression,
Formula1:="=(MOD(ROW(),2)=0"
Selection.FormatConditions(1).Interior.ColorIndex = 24
End Sub
Thanks