print macro

Tonyson

Board Regular
Joined
May 26, 2002
Messages
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. :eek:
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
replace

ThisWorkbook.PrintOut f, t

with

Sheets("Sheet1").PrintOut f, t
 
Upvote 0
Change the Sheet name to a valid sheet...or just use...
Code:
ActiveSheet.PrintOut f, t
 
Upvote 0
One more question: I want to add this:

copies = Application.InputBox("How many copies ?", Type:=1)

Where do I insert this if it works. :rolleyes:
 
Upvote 0
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?
:eek:
 
Upvote 0
According to Microsoft Help, the copies property sets the number of copies to print...
Microsoft Help said:
Copies Optional Variant. The number of copies to print. If this argument is omitted, one copy is printed.
Are you sure it is printing an extra copy? :unsure:
 
Upvote 0

Forum statistics

Threads
1,214,834
Messages
6,121,871
Members
449,055
Latest member
excelhelp12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top