Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default macro to select sheets/page in a workbook and print them

Hi, I am trying to work out a macro to select both the sheets and the pages to print in a workbook. I want to have a dialog box open to select the sheets to be printed and the page on the sheet to print. I have started this macro but am not sure where to go now. I have the dialog boxes and the select sheets to print working but not the select pages. Can someone tell me how to get the dialog box to select pages working? Or any other mistakes I made so far? I am pretty new at this and what I have I "borrowed". :

Thanks

Tod

Sub PrintSelectedSheets(
x = InputBox("First Sheet to Print"
y = InputBox("Last Sheet to Print"
x = InputBox("First Page to Print"
y = InputBox("Last Page to Print"
For Each ws In Worksheet
If ws.Index = Worksheets(x).Index And
ws.Index <= Worksheets(y).Index The
ws.PrintOut From:=5, To:=5, Copies:=1, Collate
:=Tru
End I
Nex
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default macro to select sheets/page in a workbook and print them

Sub PrintSelectedSheets()
x = InputBox("First Sheet to Print")
y = InputBox("Last Sheet to Print")
z = InputBox("First Page to Print")
w = 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:=z, To:=w, Copies:=1, Collate _
:=True
End If
Next
End Sub

--

Vasant

"Todd" wrote in message
...
Hi, I am trying to work out a macro to select both the sheets and the

pages to print in a workbook. I want to have a dialog box open to select
the sheets to be printed and the page on the sheet to print. I have started
this macro but am not sure where to go now. I have the dialog boxes and the
select sheets to print working but not the select pages. Can someone tell
me how to get the dialog box to select pages working? Or any other mistakes
I made so far? I am pretty new at this and what I have I "borrowed". :)

Thanks.


Todd

Sub PrintSelectedSheets()
x = InputBox("First Sheet to Print")
y = InputBox("Last Sheet to Print")
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:=5, To:=5, Copies:=1, Collate _
:=True
End If
Next
End Sub



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
how do i print two workbook sheets onto one page side by side? geeall Excel Discussion (Misc queries) 1 May 9th 09 08:43 PM
How can I print only select sheets in my workbook? MVictoreen New Users to Excel 2 March 28th 08 10:21 PM
Print 1st Page Multiple Sheets in Same Workbook Ben Dummar Excel Discussion (Misc queries) 8 May 22nd 07 09:18 PM
Macro to select and print sheets JoeP Excel Discussion (Misc queries) 3 April 19th 07 06:44 PM
Print Macro both sheets at once with option to select days etc pano Excel Worksheet Functions 0 January 29th 07 04:09 AM


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