I need to check multiple cell values to see if there is a value present in the cell prior to proceeding with the print action. I will be needing to add multiple additional cells to the following code, and am also wondering if I have a range such as AO15:AO16, if that can be entered into on one line instead of two.
Also, if there is a better way to do this besides using 50 Else/If statements, it would truly save me headaches and code confusion.
Private Sub PRINTMR1_Click()
'Checks whether specific cells have required data
If IsEmpty(ActiveSheet.Range("av4")) Then
MsgBox "Fill in Measured Depth", vbCritical, "Input Error"
GoTo exit_proc
Else
If IsEmpty(ActiveSheet.Range("o42")) Then
MsgBox "Fill in MW Sample 1", vbCritical, "Input Error"
GoTo exit_proc
Else
If IsEmpty(ActiveSheet.Range("f73")) Then
MsgBox "Fill in Mud Type", vbCritical, "Input Error"
GoTo exit_proc
Else
If IsEmpty(ActiveSheet.Range("av2")) Then
MsgBox "Fill in Report Date", vbCritical, "Input Error"
GoTo exit_proc
Else
If IsEmpty(ActiveSheet.Range("ao13")) Then
MsgBox "Fill in Pump #1 Data", vbCritical, "Input Error"
GoTo exit_proc
Else
If IsEmpty(ActiveSheet.Range("ao15")) Then
MsgBox "Fill in Pump #1 Data", vbCritical, "Input Error"
GoTo exit_proc
Else
If IsEmpty(ActiveSheet.Range("ao16")) Then
MsgBox "Fill in Pump #1 Data", vbCritical, "Input Error"
GoTo exit_proc
End If
End If
End If
End If
End If
End If
End If
'Prints Selected Range
ActiveSheet.PageSetup.PrintArea = "$A$1:$bh$105"
Application.Dialogs(xlDialogPrint).Show
ActiveSheet.PageSetup.PrintArea = ""
'Skips print execution upon errors
exit_proc:
End Sub
Bookmarks