How do I put a button on an excel spreadsheet to print a report?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi please help
I want to put a button onto a excel spreadsheet (not the toolbar) that will
print a report for me from another sheet, what macro do I use and what
options do I use
Regards
Casper
 
I would record a macro when I printed what I wanted.

Then I'd use a button from the Forms toolbar and plop it onto that other
sheet--and assign that recorded macro to that button.

Your recorded macro may look something like:

Option Explicit
Sub Macro1()
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub

I'd change it to be more specific (and give it a nice name):

Option Explicit
Sub PrintSheet1()
worksheets("sheet1").PrintOut Copies:=1, Collate:=True
End Sub
 
Hi Casper,

Try going to design mode in your toolbar and clicking on the comman
button icon place it on the sheet desired then right click the button
click view code and try placing the code below.

I set this up as sheet 2 being the one printed, change as needed. Th
same will go for the print range.


Code
-------------------

Sub CommandButton1_Click()
Application.ScreenUpdating = False
Sheets("sheet2").Visible = True
Sheets("sheet2").Select

ActiveSheet.PageSetup.PrintArea = "$A$1:$I$508"
ActiveWindow.SelectedSheets.PrintOut copies:=1, collate:=True
Sheets("sheet2").Visible = True
Application.ScreenUpdating = True

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top