View Full Version : [SOLVED:] Stop if one of three conditions are true
outrider
03-20-2005, 02:49 PM
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.
:dunno
Zack Barresse
03-20-2005, 03:09 PM
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
mdmackillop
03-20-2005, 03:12 PM
Try the following
Sub DoPrint()
If [G5] = "" Or [H17] = "" Or [B42] = "" Then
Exit Sub
Else
MsgBox "Do Printing"
End If
End Sub
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.
:dunno
Assuming that I understand your criteria, try something like this:
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
outrider
03-20-2005, 04:07 PM
Thanks for all the help, it's really appreciated.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.