Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Conditional Printing
Hi,
I would like to know if anybody has any VB script that will allow me to conditionally print worksheets. Currently I have a workbook that has 30 worksheets, I want the script to look at one cell in each worksheet and if that cell is 1 then it prints the worksheet. Thanks. James |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Conditional Printing
James
Private Sub Workbook_BeforePrint(Cancel As Boolean) Application.ScreenUpdating = False Dim n As Single For n = 1 To Sheets.Count If Sheets(n).Range("A1").Value = 1 Then Sheets(n).PrintPreview 'PrintOut End If Next n Application.ScreenUpdating = True End Sub Place code into Thisworkbook Module or change name to Sub Print_Sheets() and place into a general module and run when you want. Gord Dibben MS Excel MVP On Tue, 24 Jul 2007 12:36:32 -0700, James wrote: Hi, I would like to know if anybody has any VB script that will allow me to conditionally print worksheets. Currently I have a workbook that has 30 worksheets, I want the script to look at one cell in each worksheet and if that cell is 1 then it prints the worksheet. Thanks. James |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Printing a heading on each new page when printing | Excel Discussion (Misc queries) | |||
Printing cells with conditional formats & formulas | Excel Discussion (Misc queries) | |||
Printing conditional images | Excel Discussion (Misc queries) | |||
Printing of cells in Excel with conditional equations? | Excel Discussion (Misc queries) | |||
Enable Double sided printing contiuously when printing multiple s. | Excel Discussion (Misc queries) |