Printing Problems

ninjak

Board Regular
Joined
Mar 13, 2003
Messages
82
Is there a way to make a macro that i can choose what page to print ? on my sheet named compare i devided it up into 10 sheets but i cannot figure out how to make it print the page i want it too print say i wanted it too print page 5 and only 5 can somebody help me make something that will work please


Thanks AL
 

Some videos you may like

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)

tactps

Well-known Member
Joined
Jan 20, 2004
Messages
3,459
If you want them to print a single page, and they know what page number to print, try:

Sub macro()
Input1 = InputBox("Which page would you like to print?", "Print")
ActiveWindow.SelectedSheets.PrintOut From:=Input1, To:=Input1, Copies:=1, Collate _
:=True
End Sub
 

Yogi Anand

MrExcel MVP
Joined
Mar 12, 2002
Messages
11,454
Hi AL:

To print a specific page or a range of pages, you do not necessarily need a macro, you can do FILE|Print ... and then in the Print_range portion of the dialog box choose the option Page(s) and then key-in From and To page numbers.
 

Ian Mac

MrExcel MVP
Joined
Feb 20, 2002
Messages
1,174
Something like:

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
 

ninjak

Board Regular
Joined
Mar 13, 2003
Messages
82

ADVERTISEMENT

How can i make it always choose compare worksheet and then ask me what page ?


Thanks AL
 

tactps

Well-known Member
Joined
Jan 20, 2004
Messages
3,459
Press Alt-F11, which will bring up VBA.

From the insert menu, choose "module"

Copy and paste the detail in.

To use, press Alt-F8 and run the macro (or you can attach it to a button)
 

ninjak

Board Regular
Joined
Mar 13, 2003
Messages
82

ADVERTISEMENT

alright i figure out how to add it is there a way to make it always choose compare sheet and when i print stuff now it shows little dotted lines how to i get those to go way after i print ?

Thanks AL
 

tactps

Well-known Member
Joined
Jan 20, 2004
Messages
3,459
Add the line:
Sheets("Compare").Select
before the input box.

Dotted lines sound like page breaks

If you have lines showing, you are either looking at it in page preview mode (click on view and choose normal to fix), or your options shown page breaks (tools, options, view tab - unchekc "page breaks")
 

Watch MrExcel Video

Forum statistics

Threads
1,122,970
Messages
5,599,106
Members
414,287
Latest member
Rbwester

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
Top