#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default conditional printing

Is it possible to prevent printing based on zero value in a particular cell?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default conditional printing

Put this in the ThisWorkbook module. Change sheet and cell to suit.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
With Sheets("sheet6")
If Len(Trim(.Range("c1"))) < 1 Then Cancel = True
End With
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Conditional printing" <Conditional

wrote in message ...
Is it possible to prevent printing based on zero value in a particular
cell?


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,316
Default conditional printing

You can verify the value in the cell with the workbooks BeforePrint event.

Press Alt+F11 to open the Visual Basic Editor. In the project Explorer in
the upper-left pane, doiuble click on the ThisWorkbook icon.

In the combobox at the top of the module on the left, change the object to
workbook, and the in the combobox on the right change the event to the
BeforePrint event. Use something like to following code to control the
printing, substituting the worksheet index number with either the name of the
worksheet as a string or its index number, and the cell address A1 to the
cell that contains the value you wish to verify:

Private Sub Workbook_BeforePrint(Cancel As Boolean)

If ThisWorkbook.Worksheets(1).Range("A1").Value = 0 Then
MsgBox "There is nothing to print at this time."
End If

Cancel = True

End Sub
--
Kevin Backmann


"Conditional printing" wrote:

Is it possible to prevent printing based on zero value in a particular cell?

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 468
Default conditional printing

Paste this into your ThisWorkbook Code Window << Change as necessary

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If Range("C4") = "" Then
MsgBox "Cell C4 is empty"
Cancel = True
End If
End Sub

"Conditional printing" wrote:

Is it possible to prevent printing based on zero value in a particular cell?

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 468
Default conditional printing

better make that line...

If Range("C4") = 0 Then

Sorry

"Conditional printing" wrote:

Is it possible to prevent printing based on zero value in a particular cell?

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
Conditional auto printing in excell? Steve Excel Worksheet Functions 1 October 27th 07 03:18 PM
Conditional printing based on cells greater than zero dillon Excel Worksheet Functions 1 September 12th 07 12:01 AM
Conditional Printing James[_4_] Excel Discussion (Misc queries) 1 July 24th 07 10:45 PM
Printing conditional images Trav Excel Discussion (Misc queries) 6 January 12th 06 02:46 AM
Printing of cells in Excel with conditional equations? Mic Kenney Excel Discussion (Misc queries) 1 June 1st 05 12:39 AM


All times are GMT +1. The time now is 06:10 PM.

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

About Us

"It's about Microsoft Excel"