Print Button

dafricano

New Member
Joined
Feb 1, 2005
Messages
7
Trying to make a button print a selected range on the active sheet, here is what I have. Obvioulsy it's not working and any help would be greatly appreciated.

Private Sub CommandButton1_Click()
Select Case ActiveSheet.CodeName
Case ActiveWindow.SelectedSheets
Sheet1ActiveWindow.SelectedSheets.PageSetup.PrintArea = "$A$72:$G$112"
ActiveWindow.SelectedSheets.PrintOut
End Select
End Sub

Thanks dafricano
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
dafricano,

isn't this enough?

Private Sub CommandButton1_Click()
With ActiveSheet
.PageSetup.PrintArea = "$A$72:$G$112"
.PrintOut
End With
End sub

kind regards,
Erik
 
Upvote 0

Forum statistics

Threads
1,203,241
Messages
6,054,338
Members
444,717
Latest member
melindanegron

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