Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 177
Default a for selected sheets print named page macro

Hi, I am working with a macro to print out all sheets in a workbook. I figure to group the sheets I want and then select which page to print. For example, I wish to print page 8 for every selected sheet.

My macro doesn't work. Did you know that already? Its pasted below, I get errors at the IF. Can anyone see the error and tell how to fix it?


Thanks,


Todd



Sub PrintSelectedSheets()
For Each sh In ActiveWindow.SelectedSheets
sh.Activate
x = InputBox("First Page to Print")
y = InputBox("Last Page to Print")
For Each ws In Worksheets
If ws.Index = Worksheets(x).Index
And ws.Index <= Worksheets(y).Index
Then ws.PrintOut From:=, To:=, Copies:=1, Collate :=True
End If
Next
Next
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default a for selected sheets print named page macro

If I understand you correctly:

Public Sub PrintSelectedSheets()
Dim sh As Worksheet
Dim x As Long
Dim y As Long
x = InputBox("First Page to Print")
y = InputBox("Last Page to Print")
For Each sh In ActiveWindow.SelectedSheets
sh.PrintOut _
From:=x, _
To:=y, _
Copies:=1, _
Collate:=True
Next sh
End Sub


In article ,
"Todd" wrote:

Hi, I am working with a macro to print out all sheets in a workbook. I
figure to group the sheets I want and then select which page to print. For
example, I wish to print page 8 for every selected sheet.

My macro doesn't work. Did you know that already? Its pasted below, I get
errors at the IF. Can anyone see the error and tell how to fix it?

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
add page numbers to selected sheets SLA Excel Worksheet Functions 1 August 24th 07 12:48 AM
Print a selected number of sheets RobN[_3_] Excel Discussion (Misc queries) 9 June 8th 07 12:28 PM
Print preview and print only shows 2/3 of page selected Financial planner Excel Discussion (Misc queries) 1 January 9th 07 06:26 PM
How to print a selected number of sheets? Rafat Excel Worksheet Functions 0 June 9th 06 02:50 PM
macro to select sheets/page in a workbook and print them Todd Excel Programming 1 June 8th 04 04:19 AM


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