Need button "PRINT"

sporitus

New Member
Joined
Jan 23, 2009
Messages
34
Dear Experts:

Fot our girls I need to have the button "PRINT".
When someone press it, whole document is printing.

Please advice, ho to do this button on Excel table.

thanks
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Try

Code:
Sub prt()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
    ws.PrintOut
Next ws
End Sub
 
Upvote 0

Datsmart

Well-known Member
Joined
Jun 19, 2003
Messages
7,985
By "whole document is printing" do you mean all worksheets in the workbook or just all pages of the active worksheet?

This will print all pages of the active worksheet:
Code:
ActiveSheet.Printout
This will print all worksheets in the workbook:
Code:
ActiveWorkbook.Printout
 
Upvote 0

sporitus

New Member
Joined
Jan 23, 2009
Messages
34
Hi Datsmart;

Thanks for advice.
Where i can put this code ?

thanks
 
Upvote 0

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Press ALT + F11 to open the Visual Basic Editor, Insert > Module and paste the code into the white space on the right.

Press ALT + F11 to return to your sheet, add a button from the Forms toolbar and assign it to the macro.
 
Upvote 0

sporitus

New Member
Joined
Jan 23, 2009
Messages
34
VoG;

Thanks a lot. it looks like work.

Could you advice how to make some sheets unprintable when i push print whole workbook ?
 
Upvote 0

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Try this

Code:
Sub prt()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
    If ws.Name <> "2007" And ws.Name <> "2008" And ws.Name <> "2009" Then ws.PrintOut
Next ws
End Sub
 
Upvote 0

Forum statistics

Threads
1,191,076
Messages
5,984,497
Members
439,893
Latest member
johnsboxftm

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