Good afternoon,
I looked through multiple posts on the forum boards, but something is not working properly with my code. I was hoping some of you VB experts can help me.
What I wish for it to do = look up errors in a column, highlight the erroneous cells red, and popup a msgbox once saying "Please enter valid month".
I created a public sub function to do the lookups..I think the code will speak to itself:
Please help! I hate VB now
I looked through multiple posts on the forum boards, but something is not working properly with my code. I was hoping some of you VB experts can help me.
What I wish for it to do = look up errors in a column, highlight the erroneous cells red, and popup a msgbox once saying "Please enter valid month".
I created a public sub function to do the lookups..I think the code will speak to itself:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'Checks if vlookup function returns an "ERROR" for all data validation and vendor number fields.
'If it is blank or has valid data, no conditional formatting will be used.
'If checks = "Error" then cell should be highlighted and a msgbox will popup requesting user to enter valid info.
Check_Month
End Sub
Code:
Public Sub Check_Month()
Dim Warning As Boolean
For i = 2 To 9999
If Cells(i, 22).Value = "ERROR" Then
Cells(i, 1).Interior.Color = RGB(198, 30, 2)
MsgBox "Please enter valid Month"
Warning = True
Else:
Cells(i, 1).Interior.ColorIndex = 0
Warning = False
End If
Next i
End Sub
Please help! I hate VB now