You can try this out:
Dim rngFound As Excel.Range
Dim rngStart As Excel.Range
Dim fmtCurr As FormatCondition
Dim intCol As Integer
Dim lngFoundRow As Long
Set rngStart = Range("A2")
intCol = rngStart.Column
On Error Resume Next
lngFoundRow = ActiveSheet.Columns(intCol).Find(What:="customer", After:=Cells(1, intCol), _
SearchOrder:=xlByRows, SearchDirection:=xlNext, _
LookAt:=xlPart, LookIn:=xlValues).Row
If Err <> 0 Then
lngFoundRow = 0
End If
On Error GoTo 0
If lngFoundRow > rngStart.Row Then
Set rngFound = Cells(rngStart.Row, intCol).Resize(lngFoundRow - rngStart.Row + 1, 1)
With rngFound.Font
.ThemeColor = 2
.TintAndShade = -0.349986266670736
End With
For Each fmtCurr In rngFound.FormatConditions
fmtCurr.Delete
Next fmtCurr
With rngFound.FormatConditions.Add(Type:=xlExpression, Formula1:="=RC3>0")
.SetFirstPriority
With .Font
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
End With
.StopIfTrue = False
End With
End If
Set rngStart = Nothing
Set rngFound = Nothing
It is a bit longer code, but does less processing. Change the Set rngStart line to point to the starting cell of the data on your worksheet. It first finds "Customer" in the given column, then assigns a range object to the cells from rngStart to the cell right above "Customer". It deletes any existing conditional formatting, then adds new conditional formatting as your code does.
Bookmarks