excel: no blank

  • Thread starter Thread starter George
  • Start date Start date
G

George

Hi,
I am looking for a macro before print to verify if specify cell is filled
with values..
Thanks.
George...
 
Copy the following code into the workbook's code module. To get to the right
place: right-click on the Excel icon to the left of the word "File" in the
Excel menu and choose [View Code] from the popup list. Copy the code below
into it and modify it to use the correct sheet name and cell that needs to
have data in it before it can be printed.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If IsEmpty(Worksheets("Sheet1").Range("A1")) Then
Cancel = True ' cancel printing
'don't print if the cell on the sheet is empty
'could put a message as:
MsgBox "No entry on sheet 'Sheet1', cell A1"
End If
End Sub
 
Back
Top