VBA Conditional Format

M

Mark1

I cannot get why this is giving me the "object doesn't support this property
or method" message at the '.Font.ColorIndex = 10' line. What's the deal? I
recorded a macro that did the same thing and the code is pretty much the
same. Thanks!

Dim h As Range
Set h = ActiveSheet.Range("D11, D12, D14, D19, D20, D22, K11, K12, K14,
K19, K20")

With h.FormatConditions
.Delete
.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="=B11"
End With

With h
.Select
.Selection.FormatConditions(1).Font.ColorIndex = 10
End With
 
B

Bernie Deitrick

Mark,

Simply remove the

..Selection

from that line, or change

With h
.Select
.Selection.FormatConditions(1).Font.ColorIndex = 10
End With

to

h.FormatConditions(1).Font.ColorIndex = 10

HTH,
Bernie
MS Excel MVP
 
Top