Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default deny printing for certain blank cells

How do I make a macro button that will return the user back to the
spreadsheet if certain cells are not filled in?

Thanks,
Tim
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 28
Default deny printing for certain blank cells

Use the BeforePrint event in the ThisWorkbook module. Are you familiar with
this?
Here is some sample code:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
'BOTH cells must contain data before printing-
If Application.WorksheetFunction.CountA(Range("A1,C25 ")) < 2 Then
Cancel = True
MsgBox "A1 and C25 must have values"
End If
End Sub

--
---
HTH
Roger
Shaftesbury (UK)
(Excel 2003, Win XP/SP2)





"huntnpeck2" wrote in message
...
How do I make a macro button that will return the user back to the
spreadsheet if certain cells are not filled in?

Thanks,
Tim



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 36
Default deny printing for certain blank cells

Add this code to the ThisWorkbook code:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If Worksheets("Sheet1").Cells(1, 1) = "" Then
MsgBox "Cancelled"
Cancel = True
End If
End Sub

If Cell A1 on Sheet1 is empty then the print job will be cancelled.

"huntnpeck2" wrote:

How do I make a macro button that will return the user back to the
spreadsheet if certain cells are not filled in?

Thanks,
Tim

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
grid lines printing with blank cells [email protected] Excel Discussion (Misc queries) 1 March 28th 07 03:28 AM
printing blank cells cmh Excel Discussion (Misc queries) 2 November 15th 06 08:11 PM
How do I deny opening and viewing any file to any user and lock i. Leah Wright Excel Discussion (Misc queries) 1 April 22nd 05 11:59 PM
Deny file access if user declines macros? [email protected] Excel Discussion (Misc queries) 3 February 7th 05 03:02 PM
In Exel 2000, stop the blank cells (with formulas) from printing. tonyoc Excel Discussion (Misc queries) 1 December 10th 04 12:38 AM


All times are GMT +1. The time now is 02:44 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"