How to print a defined named range with command button

RJSIGKITS

Board Regular
Joined
Apr 15, 2013
Messages
109
Hi Guys.

I Have a sheet ("Quote") that I need to add a CommandButton to to print out a range that I have set as a print area.
The sheet itself will have numerous named ranges that need to print independently of each other according to what is needed.

So, at this time all I need to know is:

I have a Print Area Defined called "QuotePrint"
I Have a "CommandButton3"

I want to click the button, and it print only the defined "QuotePrint" area.

What should I change this to to do this, please?

Code:
Private Sub CommandButton3_Click()ThisWorkbook.Sheets("Quote").PrintPreview
End Sub

I will then need to have another button on a different sheet ("Home") to print off another range from the same "Quote" sheet that will print off a "SupplierOrderLog_Print" named range from the "Quote" sheet...

Any help comes with bucket loads of gratitude!
 
I've tested this with the button on the Quote sheet, starting with the columns unhidden and hidden, and in both cases I don't get any error and the printpreview works as expected.

Is there any event code like Worksheet_Change on that sheet?

Hi.

Yes, On my "Quote" Sheet, I Have a case changing event:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)Application.EnableEvents = False
If Not Application.Intersect(Target, Range("A11:A40")) Is Nothing Then
Target(1).Value = UCase(Target(1).Value)
End If
Application.EnableEvents = True
End Sub
 
Upvote 0

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
I've tested this with the button on the Quote sheet, starting with the columns unhidden and hidden, and in both cases I don't get any error and the printpreview works as expected.

Is there any event code like Worksheet_Change on that sheet?

I've just tried taking the Change event code out, and I'm still getting the same.
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,551
Members
449,088
Latest member
davidcom

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