Printing a Pivot Chart

CTibo

New Member
Joined
Aug 7, 2018
Messages
2
I built a Pivot Chart that uses Slicers to filter down my data. Once built, I can select the Pivot Chart, File, Print, adjust my margins, layout, etc... and I get the result I want, i.e the Pivot Chart only, no slicers, no Pivot Tables.

I then Locked everything so users can only use the slicers and not mess with any of the formatting,... It's working great BUT... when I go to Print as before, I now get the Pivot Chart, Slicers, Pivot Table and anything else that may be on the worksheet.

I read about making a Print button with a Macro but I have not found any examples yet for a Pivot Chart, I found examples for a Pivot Table only as of yet.

My Question: If a button with a Macro is the best approach, How do I go about to build such Macro that would select the Pivot Chart and print it without all the extra stuff around it? or is there an easier way that I am missing??

Thank you for your help!!!
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Ok, I think I figured it out.

I placed a button and recorded a macro (That part was a lot easier than I first expected) my macro first unprotect my work sheet then select the pivot chart, execute a print preview (this to allow user to cancel if button was pressed by mistake and also allow user to select which printer to send job to) finally the macro protects the worksheet again.

here's my code...
Sub PrintPivotChart()
'
' PrintPivotChart Macro
'


'
ActiveSheet.Unprotect
ActiveSheet.ChartObjects("Chart").Activate
ActiveWindow.SelectedSheets.PrintPreview (EnableChanges)
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowUsingPivotTables:=True
End Sub​

I am not a programmer, I am open to comments if anyone finds ways I could improve my code for any reason.

Cheers
 
Upvote 0

Forum statistics

Threads
1,223,902
Messages
6,175,278
Members
452,629
Latest member
SahilPolekar

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