Using VB 2010, I am trying to convert an excel file into VB and am struggling with this conditional formatting line where TextOperator:=xlContains)
I have got most of others done i.e. Excel.XlFormatConditionType.
Dim r As Excel.Range
R = oSheet.Range("A" & CStr(FirstEmptyInColA) & ":A" & CStr(lastRow)).SpecialCells(Excel.XlCellType.xlCellTypeVisible)
For A = 0 To UBound(AgentNames)
BColour = BColour + 1
If BColour > 10 Then BColour = 3
With r
.FormatConditions.Add(Type:=Excel.XlFormatConditionType.xlTextString, String:=AgentNames(A), TextOperator:=xlContains)
.FormatConditions(r.FormatConditions.Count).SetFirstPriority()
With .FormatConditions(1)
.Interior.PatternColorIndex = oWorkbook.xlAutomatic
.Interior.ColorIndex = BColour
If BColour = 5 Or BColour = 7 Or BColour = 9 Then
.Font.ColorIndex = 2
End If
End With
.FormatConditions(1).StopIfTrue = False
End With
Next A
r = Nothing

TextOperator:=Excel.XlContainsOperator.xlContains