#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 14
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default 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
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
Printing a heading on each new page when printing Brian Excel Discussion (Misc queries) 3 November 15th 06 05:22 PM
Printing cells with conditional formats & formulas John R. Excel Discussion (Misc queries) 2 May 31st 06 12:11 AM
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
Enable Double sided printing contiuously when printing multiple s. Lee Excel Discussion (Misc queries) 1 November 27th 04 01:58 AM


All times are GMT +1. The time now is 08:58 AM.

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"