Hi
I want to change the Font Colour on based of some condition
e.g.
If number is 100% and above then change the font color to Green
If it's above 95% and Less than 100% then change font color Amber
If it's less than 95% then change color to Red
I'm using below code:
Code:
Sub setRAGStatus(strRange As String)
objXLSheet.range(strRange).Select
objXLSheet.range(strRange).FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="=1"
objXLSheet.range(strRange).FormatConditions(Selection.FormatConditions.count).SetFirstPriority
objXLSheet.range(strRange).FormatConditions(1).Font.Color = RGB(0, 255, 0)
objXLSheet.range(strRange).Select
objXLSheet.range(strRange).FormatConditions.Add Type:=xlCellValue, Operator:=xlBetween, Formula1:="=0.95", Formula2:="=1"
objXLSheet.range(strRange).FormatConditions(Selection.FormatConditions.count).SetFirstPriority
objXLSheet.range(strRange).FormatConditions(1).Font.Color = RGB(255, 153, 0)
objXLSheet.range(strRange).Select
objXLSheet.range(strRange).FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, Formula1:="=0.95"
objXLSheet.range(strRange).FormatConditions(Selection.FormatConditions.count).SetFirstPriority
objXLSheet.range(strRange).FormatConditions(1).Font.Color = RGB(255, 0, 0)
End Sub
This code worked only once but now it's not working quite wiered 
I'm getting error below error
"Run time error 91"
"Object variable or with block variable not set"
Above error I'm getting at below line
Code:
objXLSheet.range(strRange).FormatConditions(Selection.FormatConditions.count).SetFirstPriority
Highly appreciate your help