Everything was working fine until I added my 11th rule.
Now, on my 11th rule I'm getting Subscript out of range, Run-time error '9':
When I run this by itself, I have no troubles.
When I incorporate it into the following, that's when I get the out of range error.
Now, on my 11th rule I'm getting Subscript out of range, Run-time error '9':
When I run this by itself, I have no troubles.
VBA Code:
Sub anothertest()
With Range(Cells(2, 14), Cells(574, 14))
.FormatConditions.Add Type:=xlExpression, Formula1:="=RIGHT(RC14,5)=""To Go"""
With .FormatConditions(1)
.Interior.Color = RGB(255, 192, 0) 'ORANGE
.StopIfTrue = False
End With
End With
End Sub
When I incorporate it into the following, that's when I get the out of range error.
VBA Code:
With Cells
.FormatConditions.Delete
.FormatConditions.Add Type:=xlTextString, String:="N/A", TextOperator:=xlContains
With .FormatConditions(1)
.Interior.Color = RGB(0, 0, 0) 'BLACK
.StopIfTrue = False
End With
.FormatConditions.Add Type:=xlTextString, String:="Complete", TextOperator:=xlBeginsWith
With .FormatConditions(2)
.Interior.Color = RGB(0, 176, 80) 'GREEN
.StopIfTrue = False
End With
.FormatConditions.Add Type:=xlTextString, String:="Registered", TextOperator:=xlContains
With .FormatConditions(3)
.Interior.Color = RGB(255, 255, 0) 'YELLOW
.StopIfTrue = False
End With
.FormatConditions.Add Type:=xlTextString, String:="Needs*", TextOperator:=xlContains
With .FormatConditions(4)
.Interior.Color = RGB(255, 0, 0) 'RED
.StopIfTrue = False
End With
.FormatConditions.Add Type:=xlTextString, String:="*Remaining", TextOperator:=xlContains
With .FormatConditions(5)
.Interior.Color = RGB(255, 0, 0) 'RED
.StopIfTrue = False
End With
.FormatConditions.Add Type:=xlTextString, String:="Required", TextOperator:=xlContains
With .FormatConditions(6)
.Interior.Color = RGB(255, 0, 0) 'RED
.StopIfTrue = False
End With
.FormatConditions.Add Type:=xlTextString, String:="Test", TextOperator:=xlContains
With .FormatConditions(7)
.Interior.Color = RGB(112, 48, 160) 'PURPLE
.StopIfTrue = False
End With
.FormatConditions.Add Type:=xlTextString, String:="Up to Date", TextOperator:=xlContains
With .FormatConditions(8)
.Interior.Color = RGB(0, 176, 80) 'GREEN
.StopIfTrue = False
End With
End With
With Range(Cells(2, 18), Cells(LR, 18))
.FormatConditions.Add Type:=xlTextString, String:="Yes", TextOperator:=xlContains
With .FormatConditions(9)
.Interior.Color = RGB(0, 176, 80) 'GREEN
.StopIfTrue = False
End With
.FormatConditions.Add Type:=xlTextString, String:="No", TextOperator:=xlContains
With .FormatConditions(10)
.Interior.Color = RGB(255, 0, 0) 'RED
.StopIfTrue = False
End With
End With
With Range(Cells(2, 14), Cells(LR, 14))
.FormatConditions.Add Type:=xlExpression, Formula1:="=RIGHT(RC14,5)=""To Go"""
With .FormatConditions(11)
.Interior.Color = RGB(255, 192, 0) 'ORANGE
.StopIfTrue = False
End With
End With