My conditional formatting code is not seeming to be working. I have two columns - one of which has a vlookup. What I wish to do is do conditional formatting on the column without the vlookup. So if the vlookup returns an #N/A, the conditional formatting should highlight the cell Red, and put up a msgbox.
Here is the code I am working with - and I dont think it is right. I do not wish to do a macro, and would prefer to have this code in the worksheet sub function.
Please help!
Here is the code I am working with - and I dont think it is right. I do not wish to do a macro, and would prefer to have this code in the worksheet sub function.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'Checks if vlookup function returns an N/A.
'If it is blank or has valid data, no conditional formatting should be used.
Dim i As Long
For i = 1 To ActiveSheet.UsedRange.Rows.Count
If Range("K" & i).Value = "N/A" Then
Range("J" & i).Font.Color = vbRed
MsgBox "Please Enter Valid Vendor Information."
End If
Next i
End Sub
Please help!