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

This one I just can not figure out.
In my workbooks I will have many sheets, the first sheet and the last sheet
will always have the same name, "Master Sheet" and "Rev Record" respectivily.
I have a macro that prints the workbook but I do not want to print the first
and last worksheets. (The macro does much more than just print).
I use "ActiveWorkbook.PrintOut", which priints everything. My stumbling
block is, I do not know how many sheets will exist between the first and last
sheets nor do I know how to NOT print the two sheets mentioned.

If you understand this querry, raise your hand! ;)

Thanks in advance!

--
Regards

VBA.Noob.Confused
XP Pro
Office 2007

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Printing worksheets

sub this for your current PrintOut.

x = ThisWorkbook.Sheets.Count
For i = 2 to x - 1
Sheets(i).PrintOut
Next

"Rick S." wrote:

This one I just can not figure out.
In my workbooks I will have many sheets, the first sheet and the last sheet
will always have the same name, "Master Sheet" and "Rev Record" respectivily.
I have a macro that prints the workbook but I do not want to print the first
and last worksheets. (The macro does much more than just print).
I use "ActiveWorkbook.PrintOut", which priints everything. My stumbling
block is, I do not know how many sheets will exist between the first and last
sheets nor do I know how to NOT print the two sheets mentioned.

If you understand this querry, raise your hand! ;)

Thanks in advance!

--
Regards

VBA.Noob.Confused
XP Pro
Office 2007

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Printing worksheets

Of course, that code relies on "Master Sheet" always being the left most tab
and "Rev Record" always being the right most tab in the window view. It will
otherwise fail to do what you want.

"Rick S." wrote:

This one I just can not figure out.
In my workbooks I will have many sheets, the first sheet and the last sheet
will always have the same name, "Master Sheet" and "Rev Record" respectivily.
I have a macro that prints the workbook but I do not want to print the first
and last worksheets. (The macro does much more than just print).
I use "ActiveWorkbook.PrintOut", which priints everything. My stumbling
block is, I do not know how many sheets will exist between the first and last
sheets nor do I know how to NOT print the two sheets mentioned.

If you understand this querry, raise your hand! ;)

Thanks in advance!

--
Regards

VBA.Noob.Confused
XP Pro
Office 2007

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Printing worksheets

You can also do it with an If ... Then statement:

For Each Sheet In ThisWorkbook
If Sheet.Name < "Master Sheet" And Sheet.Name < "Rev Record" Then
Sheet.PrintOut
End If
Next

"Rick S." wrote:

This one I just can not figure out.
In my workbooks I will have many sheets, the first sheet and the last sheet
will always have the same name, "Master Sheet" and "Rev Record" respectivily.
I have a macro that prints the workbook but I do not want to print the first
and last worksheets. (The macro does much more than just print).
I use "ActiveWorkbook.PrintOut", which priints everything. My stumbling
block is, I do not know how many sheets will exist between the first and last
sheets nor do I know how to NOT print the two sheets mentioned.

If you understand this querry, raise your hand! ;)

Thanks in advance!

--
Regards

VBA.Noob.Confused
XP Pro
Office 2007

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 213
Default Printing worksheets

This one will work! The sheets I stated will always be first and last.
Only had to make one minor change from your code:
x = ActiveWorkbook.Sheets.Count
Had to use ActiveWorkbook instead of ThisWorkbook, when using ThisWorkbook
it would only count two sheets?

Amazing, I simply did not think of iterating thru each sheet.

Thanks!!!

--
Regards

VBA.Noob.Confused
XP Pro
Office 2007



"JLGWhiz" wrote:

sub this for your current PrintOut.

x = ThisWorkbook.Sheets.Count
For i = 2 to x - 1
Sheets(i).PrintOut
Next

"Rick S." wrote:

This one I just can not figure out.
In my workbooks I will have many sheets, the first sheet and the last sheet
will always have the same name, "Master Sheet" and "Rev Record" respectivily.
I have a macro that prints the workbook but I do not want to print the first
and last worksheets. (The macro does much more than just print).
I use "ActiveWorkbook.PrintOut", which priints everything. My stumbling
block is, I do not know how many sheets will exist between the first and last
sheets nor do I know how to NOT print the two sheets mentioned.

If you understand this querry, raise your hand! ;)

Thanks in advance!

--
Regards

VBA.Noob.Confused
XP Pro
Office 2007

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 Most but not all worksheets JeffH Excel Discussion (Misc queries) 1 August 1st 07 09:45 PM
Printing worksheets Tom Excel Programming 3 December 10th 05 11:35 AM
Printing worksheets Tom Ogilvy Excel Programming 2 October 25th 05 02:01 AM
Printing? Worksheets not printing the same on multiple pc's! 43fan Excel Programming 2 April 29th 04 02:34 PM
Printing Worksheets thru VBA abxy[_27_] Excel Programming 3 February 19th 04 05:34 PM


All times are GMT +1. The time now is 05:21 PM.

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"