Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Printing VBA

Hi,

I have searched hi and low for an answer and hoping that soemone can help me.

I have an Excel workbook that will protected so that no changes may be made
to it with the exception of myself and 2 others. The workbook needs a print
button that will only print of Task pages (ie page 3, 5 ,7) if there is data
in it other than the format contents. Is this possible? Is this a VBA code I
need? Please
help.

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Printing VBA

You would have to identify your Task pages somehow. Here are two
methods.

1. Hardcode (which may not be desirable) the worksheet names into a
macro.

Option Explicit

Sub PrintTaskSheets()

Dim var As Variant
Dim varArray As Variant

varArray = Array("SheetName3", "SheetName7", "SheetName9")
For Each var In varArray
ActiveWorkbook.Sheets(var).PrintOut
Next var

End Sub


2. Change the color of the Task sheets to anything but white. Print
any sheet with a non-white tab color.

Option Explicit

Sub PrintTaskSheets()

Dim sh As Variant

For Each sh In ActiveWorkbook.Sheets
If sh.Tab.ColorIndex < xlNone Then sh.PrintOut
Next sh

End Sub


Mark



Valery2105 wrote:
Hi,

I have searched hi and low for an answer and hoping that soemone can help me.

I have an Excel workbook that will protected so that no changes may be made
to it with the exception of myself and 2 others. The workbook needs a print
button that will only print of Task pages (ie page 3, 5 ,7) if there is data
in it other than the format contents. Is this possible? Is this a VBA code I
need? Please
help.

Thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Printing VBA

That should have read "Change the color of the Task sheets' tabs to
anything but white"

Mark


Mark Driscol wrote:
You would have to identify your Task pages somehow. Here are two
methods.

1. Hardcode (which may not be desirable) the worksheet names into a
macro.

Option Explicit

Sub PrintTaskSheets()

Dim var As Variant
Dim varArray As Variant

varArray = Array("SheetName3", "SheetName7", "SheetName9")
For Each var In varArray
ActiveWorkbook.Sheets(var).PrintOut
Next var

End Sub


2. Change the color of the Task sheets to anything but white. Print
any sheet with a non-white tab color.

Option Explicit

Sub PrintTaskSheets()

Dim sh As Variant

For Each sh In ActiveWorkbook.Sheets
If sh.Tab.ColorIndex < xlNone Then sh.PrintOut
Next sh

End Sub


Mark



Valery2105 wrote:
Hi,

I have searched hi and low for an answer and hoping that soemone can help me.

I have an Excel workbook that will protected so that no changes may be made
to it with the exception of myself and 2 others. The workbook needs a print
button that will only print of Task pages (ie page 3, 5 ,7) if there is data
in it other than the format contents. Is this possible? Is this a VBA code I
need? Please
help.

Thanks


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
Excel 2003 printing problem--printing 1 document on 2 pages Bons Excel Discussion (Misc queries) 0 December 24th 09 04:15 PM
Excel Printing --Borders are not printing on the same page as data Stup88 Excel Discussion (Misc queries) 1 August 7th 07 09:34 AM
Printing a heading on each new page when printing Brian Excel Discussion (Misc queries) 3 November 15th 06 05:22 PM
Enable Double sided printing contiuously when printing multiple s. Lee Excel Discussion (Misc queries) 1 November 27th 04 01:58 AM
Printing? Worksheets not printing the same on multiple pc's! 43fan Excel Programming 2 April 29th 04 02:34 PM


All times are GMT +1. The time now is 08:07 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"