![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Join Date: May 2002
Location: Dublin, CA.
Posts: 109
|
I did a search on this board for a print macro and found one that was submitted by Ian Mac back in 2/21/2002:
Sub PrintPages() Dim f, t As Integer f = InputBox("Select start page 1 to 10", "Print From") t = InputBox("Select end page " & f & " to 10", "Print To") If MsgBox("Do you wish to print pages " & f & " to " & t, vbYesNo, "Confirm print") = vbYes Then ThisWorkbook.PrintOut f, t Else End If End Sub What I would like your help in editing this macro to print a worksheet not workpages with with the same MsgBoxes to print 1 to 11 pages in my worksheet. :o |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: California
Posts: 3,857
|
replace
ThisWorkbook.PrintOut f, t with Sheets("Sheet1").PrintOut f, t |
|
|
|
|
|
#3 |
|
Join Date: May 2002
Location: Dublin, CA.
Posts: 109
|
I get a Run-time error '9':
Subscript out of range |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Dec 2002
Location: Clear Lake, TX
Posts: 4,202
|
Change the Sheet name to a valid sheet...or just use...
Code:
ActiveSheet.PrintOut f, t |
|
|
|
|
|
#5 |
|
Join Date: May 2002
Location: Dublin, CA.
Posts: 109
|
That worked great Thank you TommyGun and you too DRJ. |
|
|
|
|
|
#6 |
|
Join Date: May 2002
Location: Dublin, CA.
Posts: 109
|
One more question: I want to add this:
copies = Application.InputBox("How many copies ?", Type:=1) Where do I insert this if it works. |
|
|
|
|
|
#7 |
|
Join Date: May 2002
Location: Dublin, CA.
Posts: 109
|
Where and how can I enter the number of copies I want in this macro.
|
|
|
|
|
|
#8 |
|
MrExcel MVP
Join Date: Dec 2002
Location: Clear Lake, TX
Posts: 4,202
|
Code:
ActiveSheet.PrintOut From:=f, To:=t, Copies:=copies |
|
|
|
|
|
#9 |
|
Join Date: May 2002
Location: Dublin, CA.
Posts: 109
|
Thanks!
I chanted ActiveSheet.PrintOut From:=f, To:=t, Copies:=copies to ActiveSheet.PrintOut From:=f, To:=t, Copies:=3 and it prints 4 copies instead of 3. Any reason why? :o |
|
|
|
|
|
#10 | |
|
MrExcel MVP
Join Date: Dec 2002
Location: Clear Lake, TX
Posts: 4,202
|
According to Microsoft Help, the copies property sets the number of copies to print...
Quote:
|
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|