PDA

View Full Version : condtional formatting



lior03
09-03-2008, 02:47 AM
hello
i was using the macro recorder to built a macro to highlight various days in a range - beginning in cell I3.how can i make excel use the macro on every range i select:
Application.ScreenUpdating = False
selection.FormatConditions.Delete
selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=WEEKDAY(I3)=7"
With selection.FormatConditions(1).Font
.Bold = True
.Italic = False
.ColorIndex = 3
End With
selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=WEEKDAY(I3)=3"
With selection.FormatConditions(2).Font
.Bold = True
.Italic = False
.ColorIndex = 5
End With
selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=WEEKDAY(I3)=6"
With selection.FormatConditions(3).Font
.Bold = True
.Italic = False
.ColorIndex = 12
End With
Application.ScreenUpdating = True
thanks

Bob Phillips
09-03-2008, 02:53 AM
That code does work on a multi-region selection.