Ok, ive found some code online that does exactly what i need: http://www.rondebruin.nl/find.htm
ive managed to modify to the code to find what i want and turn the adjacent cell green, but how can i get it to do the check for an empty cell and to check if its anything other than empty or "OK"
'####################################
'Check for Rows that are equal to OK
'####################################
Private Sub Worksheet_Change(ByVal Target As Range)
Dim FirstAddress As String
Dim MySearch As Variant
Dim myColor As Variant
Dim Rng As Range
Dim I As Long
'Fill in the search Value and color Index
MySearch = Array("OK")
myColor = Array("4")
'You can also use more values in the Array
'MySearch = Array("ron", "jelle", "judith")
'myColor = Array("3", "6", "10")
'Fill in the Search range, for the whole sheet use
'you can use Sheets("Sheet1").Cells
With Sheets("JAN").Range("F18:H100")
'Change the fill color to "no fill" in all cells
Interior.ColorIndex = xlColorIndexNone
For I = LBound(MySearch) To UBound(MySearch)
'If you want to find a part of the rng.value then use xlPart
'if you use LookIn:=xlValues it will also work with a
'formula cell that evaluates to MySearch(I)
Set Rng = .Find(What:=MySearch(I), _
After:=.Cells(.Cells.Count), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
FirstAddress = Rng.Address
Do
Rng.Offset(0, -1).Interior.ColorIndex = myColor(I)
Set Rng = .FindNext(Rng)
Loop While Not Rng Is Nothing And Rng.Address <> FirstAddress
End If
Next I
End With
End Sub
Bookmarks