Hi Guys,
My first post
I have written a macro to put certain text if conditions are met but now I want the text to color red when the text is either "Please enter Account." or "Please enter Dept/Restaurant." Below is the macro I have written however this is not working. Gives me the error message "400". Any help is really appreciated. Thank you
Sub Check()
For Each Cell In Range("E9:E22")
If Cell.Value <> "" Then
If (Cell.Offset(0, -1).Value = "") And (Cell.Offset(0, -2).Value = "") Then
Cell.Offset(0, -1).Value = "Please enter Account."
Cell.Offset(0, -2).Value = "Please enter Dept/Restaurant."
ElseIf (Cell.Offset(0, -1).Value = "") Then
Cell.Offset(0, -1).Value = "Please enter Account."
ElseIf (Cell.Offset(0, -2).Value = "") Then
Cell.Offset(0, -2).Value = "Please enter Dept/Restaurant."
End If
End If
Next
For Each Cell In Range("E9:E22")
If Cell.Value <> "" Then
If (Cell.Offset(0, -1).Value = "Please enter Account.") And (Cell.Offset(0, -2).Value = "Please enter Dept/Restaurant.") Then
Cell.Offset(0, -1).Font.ColorIndex = 3
Cell.Offset(0, -2).Font.ColorIndex = 3
End If
End If
Next
MsgBox "Validated. Please check & enter missing data"
End Sub
My first post
I have written a macro to put certain text if conditions are met but now I want the text to color red when the text is either "Please enter Account." or "Please enter Dept/Restaurant." Below is the macro I have written however this is not working. Gives me the error message "400". Any help is really appreciated. Thank you
Sub Check()
For Each Cell In Range("E9:E22")
If Cell.Value <> "" Then
If (Cell.Offset(0, -1).Value = "") And (Cell.Offset(0, -2).Value = "") Then
Cell.Offset(0, -1).Value = "Please enter Account."
Cell.Offset(0, -2).Value = "Please enter Dept/Restaurant."
ElseIf (Cell.Offset(0, -1).Value = "") Then
Cell.Offset(0, -1).Value = "Please enter Account."
ElseIf (Cell.Offset(0, -2).Value = "") Then
Cell.Offset(0, -2).Value = "Please enter Dept/Restaurant."
End If
End If
Next
For Each Cell In Range("E9:E22")
If Cell.Value <> "" Then
If (Cell.Offset(0, -1).Value = "Please enter Account.") And (Cell.Offset(0, -2).Value = "Please enter Dept/Restaurant.") Then
Cell.Offset(0, -1).Font.ColorIndex = 3
Cell.Offset(0, -2).Font.ColorIndex = 3
End If
End If
Next
MsgBox "Validated. Please check & enter missing data"
End Sub