I tested this code in the worksheet module:
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim R As Long
If Cells(Target.Row, "A") <> "" And Target = "" And (Target.Column = 2 Or Target.Column = 5) Then
' user is about to fill in a required field, do nothing
Else
R = 2 ' first data row
Do Until Cells(R, "A") = ""
If Cells(R, "B") = "" Then
MsgBox "You must provide " & Cells(1, "B") & " for " & Cells(R, "A") & " before continuing"
Cells(R, "B").Select
Exit Sub
ElseIf Cells(R, "E") = "" Then
MsgBox "You must provide " & Cells(1, "E") & " for " & Cells(R, "A") & " before continuing"
Cells(R, "E").Select
Exit Sub
End If
Loop
End If
End Sub
Bookmarks