Hi,
I am trying to set the conditional formatting of a particular column on a spreadsheet. I loop though the rows and set the criteria and all works well. EXCEPT when I get to about 10,000 records (not exact figure) i get the error Unable to set color index property of interior class.
Can someone please help with what the problem could be.
The code I use is as below.
I am trying to set the conditional formatting of a particular column on a spreadsheet. I loop though the rows and set the criteria and all works well. EXCEPT when I get to about 10,000 records (not exact figure) i get the error Unable to set color index property of interior class.
Can someone please help with what the problem could be.
The code I use is as below.
Code:
Set rCP = sht.Cells(8, 18)
Application.StatusBar = "Applying Conditional Formatting. Please wait...."
Do Until rCP.Row > (7 + rs.RecordCount)
With Range("R" & rCP.Row)
.FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, Formula1:="=$Q$" & rCP.Row
.FormatConditions(1).Interior.ColorIndex = 3
.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=$Q$" & rCP.Row
.FormatConditions(2).Interior.ColorIndex = 45
.FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="=$Q$" & rCP.Row
.FormatConditions(3).Interior.ColorIndex = 43
End With
Set rCP = rCP.Offset(1, 0)
Loop