Is it possible to conditional format a range of cells if the active cell is not in the range to be formatted?
I get a Runtime 9 error with the following code if I comment out the Range("H1").Activate line.
If I don't comment it out the code does what it is supposed to, however, I am trying to avoid "activate" or "select" for efficiency because I will need to loop the code through thousands of tabs.
'Range("H1").Activate
For Each b In Array("T", "P", "B", "U", "F")
With Columns("H:H")
.FormatConditions.Add Type:=xlTextString, String:=b, TextOperator:=xlContains
.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With .FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
End With
.FormatConditions(1).StopIfTrue = False
End With
Next b
Any assistance appreciated.
Bookmarks