Hi, I have a Excel Form on which I need to run a Macro to check some key cells and if the cells are empty, I want to inform the user which cell is empty and then have the macro go to the empty cell.
There may be multiple empty cells in the form
I have setup the following macro, but it doesn't seem to work. It only finds the first empty cell and then ignores any other empty cells.
Also not sure how to get the macro to return the user to each empty cell for required actions
I have added the macro I have put together below. Any assistance with this would be great.
Code
Sub Check_For_Empty_Fields()
' When user hits ADD RECORD Button, Macro checks for Missing Field Data for required upload file
If Range("J58") = "" Then
MsgBox ("Please fill in Supplier Name in Section 3.")
Exit Sub
ElseIf Range("J60") = "" Then
MsgBox ("Please fill in Street Address 1 in Section 3.")
Exit Sub
ElseIf Range("J62") = "" Then
MsgBox ("Please fill in Street Address 2 in Section 3.")
Exit Sub
ElseIf Range("J64") = "" Then
MsgBox ("Please fill in Suburb in Section 3.")
Exit Sub
ElseIf Range("J66") = "" Then
MsgBox ("Please select State in Section 3.")
Exit Sub
ElseIf Range("P66") = "" Then
MsgBox ("Please fill in Postcode in Section 3.")
Exit Sub
ElseIf Range("Y64") = "" Then
MsgBox ("Please fill in Supplier Email Address in Section 3.")
Exit Sub
ElseIf Range("Y66") = "" Then
MsgBox ("Please fill in Remittance Method in Section 3.")
Exit Sub
ElseIf Range("J72") = "" Then
MsgBox ("Please select in AR Contact Telephone Area Code in Section 3.")
Exit Sub
ElseIf Range("N72") = "" Then
MsgBox ("Please fill in AR Contact Telephone Number in Section 3.")
Exit Sub
ElseIf Range("P72") = "" Then
MsgBox ("Please fill in AR Contact Telephone Number in Section 3.")
Exit Sub
ElseIf Range("J74") = "" Then
MsgBox ("Please select in AR Contact Fax Area Code in Section 3.If Fax Number Not Applicable select (NA) from list")
Exit Sub
ElseIf Range("N74") = "" Then
MsgBox ("Please fill in AR Contact Fax Number in Section 3.If Fax Number Not Applicable enter 0000 into field")
Exit Sub
ElseIf Range("P74") = "" Then
MsgBox ("Please fill in AR Contact Fax Number in Section 3.If Fax Number Not Applicable enter 0000 into field")
Exit Sub
ElseIf Range("D78") = "" Then
MsgBox ("Please fill in ABN number in Section 3.")
Exit Sub
ElseIf Range("J78") = "" Then
MsgBox ("Please fill in ABN number in Section 3.")
Exit Sub
ElseIf Range("F84") = "" Then
MsgBox ("Please fill in Bank BSB Number in Section 3.")
Exit Sub
ElseIf Range("F86") = "" Then
MsgBox ("Please fill in Bank Account Number in Section 3.")
Exit Sub
End If
End Sub
Display More
Regards
Lance