PDA

View Full Version : Solved: with named range conditional format



khalid79m
02-19-2009, 06:54 AM
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=IF($I3,1,0)"
With Selection.FormatConditions(1).Font
.Bold = True
.Italic = False
.ColorIndex = 53
End With
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=IF($I3,2,0)"
With Selection.FormatConditions(2).Font
.Bold = True
.Italic = False
.ColorIndex = 1
End With

I have recorded the above code, i need it to apply to range Question_1 can anyone help?

Bob Phillips
02-19-2009, 08:48 AM
With Range("Question_1")

.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, _
Formula1:="=IF(" & .Cells(1, 1).Address(False, True) & ",1,0)"
With .FormatConditions(1).Font
.Bold = True
.Italic = False
.ColorIndex = 53
End With
.FormatConditions.Add Type:=xlExpression, _
Formula1:="=IF(" & .Cells(1, 1).Address(False, True) & ",2,0)"
With .FormatConditions(2).Font
.Bold = True
.Italic = False
.ColorIndex = 1
End With
End With

khalid79m
02-27-2009, 06:18 AM
thanks,, :)