I would like to put a macro in sheet1 which prints sheet2 when run. Preferably through a button. Could this be possible? How?
Thanks in advance.
I would like to put a macro in sheet1 which prints sheet2 when run. Preferably through a button. Could this be possible? How?
Thanks in advance.
Hi
So you want to print sheet 2 from a button in sheet1?
If so
Just record a macro from sheet1 of what you want i.e printing / print settings etc:
To start a macro
Tools > Macro > Record New Macro...
then to stop
Tools > Macro > Stop Recording...
When you are done just use the autoshapes function to draw a button.
Right click on the auto shape and there should be a function to assign a macro to it. Assign your recorded macro to it and you are done.
If you just want to print without chnaging the sheet it should look like the below:
Sub printsheet2()
'
' printsheet2 Macro
' Macro recorded (Date) by (User)
'
'
Sheets("Sheet2").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub
Hope it helps
JR
Versions
Mac OS X 'Leopard'
Mac MS Office Excel 2004
Windows XP
MS Excel 2002
MS Excel 2003
Thanks. But, I forgot to mention that sheet 2 is hidden. I tried to do the recording of macro to print the hidden sheet 2, but it doesn't work. Is there any other way around this?
Hi
Put theis in your macro as the only way i know around it is to hide and unhide the sheet in your code
Sheets("Sheet2").Visible = True
Sheets("Sheet2").Visible = False
so your code should look something like this
Sub printsheet2()
Sheets("Sheet1").Select
Sheets("Sheet2").Visible = True
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Sheet2").Visible = False
Range("F11:F12").Select
Range("F12").Activate
Sheets("Sheet1").Select
Range("E19").Select
End Sub
hope it helps
Thanks JR.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks