Workbook_Open Question
One way:
Public Sub ApplyCF()
With Range("A1:A" & Range("A" & Rows.Count).End( _
xlUp).Row).EntireRow.FormatConditions
.Delete
With .Add(Type:=xlExpression, _
Formula1:="=MOD(ROW(),2)=0")
.Interior.ColorIndex = 35
End With
End With
End Sub
Adjust your row definition as necessary.
In article ,
Richard Buttrey wrote:
That's an extremely interesting method and works very well for
predefined cells. However i've just tried capturing the conditional
formatting key strokes in a macro and other than the first 'select',
nothing else appears.
I'd like to be able to apply this conditional formatting to new rows
introduced by some other VBA code. I could I suppose hold this
formatting in cells in a 'spare' row and copy the formatting each time
a row is introduced, but I'd like to know how to apply it directly
with code.
|