Try surrounding the code with a do until...loop.
Range("A1").Select
Do Until ActiveCell.Value = ""
Do Until ActiveCell.Value = ""
If stripWhiteSpace(Left(Trim(UCase(Range(sRange).Text )), Len(Trim(UCase(gaDepSearch(j)))))) <> stripWhiteSpace(Trim(UCase(gaDepSearch(j)))) Then
Call WriteColourLog(Application.ActiveSheet.Name, "DEPARTURE STRING: " & _
Chr(34) & UCase(gaDepSearch(j)) & Chr(34), sRange)
Else
gbFoundDep = True
Range(sRange).Interior.ColorIndex = iColour
tempCol = Asc(extractString(sRange))
tempRow = extractNumber(sRange)
For k = tempCol To iTotalRows
sRange = Chr(tempCol) & k
tempRange = Chr(tempCol + 1) & k
If hasCityCode(Range(sRange).Text) Then
Range(sRange).Interior.ColorIndex = iColour
End If
Next
End If
ActiveCell.Offset(0, 1).Select
Loop
ActiveCell.Offset(1, -ActiveCell.Column + 1).Select
Loop
cheers
Matt
|