Hi Guys,
I have the below macro to check the cell values and if empty assign a text value and give the user a message to enter the required info. After this I want to make sure if they have entered the required cells but not really sure how to do that. Any help is highly appreciated.
Thank you
Private Sub CommandButton1_Click()
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."
MsgBox "Please check & enter missing data"
End If
End If
Next
End Sub
I have the below macro to check the cell values and if empty assign a text value and give the user a message to enter the required info. After this I want to make sure if they have entered the required cells but not really sure how to do that. Any help is highly appreciated.
Thank you
Private Sub CommandButton1_Click()
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."
MsgBox "Please check & enter missing data"
End If
End If
Next
End Sub