ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   excel: no blank (https://www.excelbanter.com/excel-discussion-misc-queries/155250-excel-no-blank.html)

George

excel: no blank
 
Hi,
I am looking for a macro before print to verify if specify cell is filled
with values..
Thanks.
George...




JLatham

excel: no blank
 
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


"George" wrote:

Hi,
I am looking for a macro before print to verify if specify cell is filled
with values..
Thanks.
George...






All times are GMT +1. The time now is 12:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com