Quote:
Originally Posted by Claus Busch
Hi Jonathan,
Am Wed, 27 Mar 2013 10:45:27 +0000 schrieb JonathanK1:
It acted like it was going to work and then stopped, highlighting the
".FormatConditions(.FormatConditions.Count).SetFir st Priority" section.
do you have other conditional formattings in your sheet? What Excel
version do you use?
Try:
Sub test()
Dim LRow As Long
LRow = Cells(Rows.Count, "Q").End(xlUp).Row
Range("$Q$2:$Q$" & LRow).Select
With Selection
.FormatConditions.Add Type:=xlExpression, Formula1:="=$Q2<2008"
With .FormatConditions(1).Interior
.ColorIndex = 3
End With
End With
End Sub
and if it doesn't work, try:
Sub test2()
Dim LRow As Long
Dim rngC As Range
LRow = Cells(Rows.Count, "Q").End(xlUp).Row
For Each rngC In Range("$Q$2:$Q$" & LRow)
rngC.Interior.ColorIndex = IIf(rngC < 2008, 3, xlNone)
Next
End Sub
Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
|
The first one worked perfectly. Thank you!!!!
J-