Hi Folks,
I need to add a check to one of my printout macros.
If cell G5 or cell H17 or cell B42 have no data, then the macro should stop.
Any help appreciated.
Hi Folks,
I need to add a check to one of my printout macros.
If cell G5 or cell H17 or cell B42 have no data, then the macro should stop.
Any help appreciated.
Hi,
Add this to the top of your code where it's desired ...
If IsEmpty([G5]) Or IsEmpty([H17]) Or IsEmpty([B42]) Then Exit Sub
Regards, Zack Barresse
Check out the KB! :|: BOARD TAGS: WHAT ARE THEY AND HOW DO I USE THEM
What is a Microsoft MVP? | Free Microsoft Courses | My Book on Excel Tables
Try the following
Sub DoPrint() If [G5] = "" Or [H17] = "" Or [B42] = "" Then Exit Sub Else MsgBox "Do Printing" End If End Sub
Assuming that I understand your criteria, try something like this:Originally Posted by outrider
If Cells(5, 7) = "" Or Cells(17, 8) = "" Or Cells(42, 2) = "" Then MsgBox "stopping print macro because one or more key cells is blank" Exit Sub End If
Thanks for all the help, it's really appreciated.