print specific chart(s)

Jockster

Board Regular
Joined
Jan 16, 2009
Messages
88
A worksheet called "Charts" has 13 charts on it.
I would like the ability for the user print out any of the charts by clicking a button and then being asked which chart to print. The user simply enters the chart number into an input box and that specific chart is printed to A4.
A second option to print all charts onto seperate sheets of paper would also be great.
Is this sort of thing do-able?
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Here is sample code to allow you to select a chart by using an inputbox, I haven't included anything if there is no chart number

<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> PrintCharts()<br><SPAN style="color:#007F00">'Allow to print preview selected chart</SPAN><br><SPAN style="color:#00007F">Dim</SPAN> i <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN><br>i = InputBox("Which Chart Do you want to Print", "Charts")<br>ActiveSheet.ChartObjects("Chart " & i).Activate<br>ExecuteExcel4Macro "PRINT(1,,,1,,TRUE,,,,,,2,,,TRUE,,FALSE)"<br><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>
 
Upvote 0
Thanks Trevor. Just the job.

Do you know how I would add username, date and time to the footer when print previeved? That would be really handy!

I tried:
Code:
With ActiveSheet.ChartObjects("Chart " & i)
         .LeftFooter = "Revised on " & Date & " by " & Application.UserName
End With
but it errored.
 
Upvote 0

Forum statistics

Threads
1,224,582
Messages
6,179,670
Members
452,936
Latest member
anamikabhargaw

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