P
Petrov
I have a little problem with some code I've been using. In my workbook I have
7 sheets with 45+ pre-made charts. Some have data but most don't. The current
code I have counts how many charts there are on the sheet, selects,
activates, and prints them all the way I like. Thing is I'd like it to print
only the charts with data in them.
I thought that a code could be made that checks the source range of the
chart for numbers then prints that chart. However because there are 45+
charts and 7 sheets that would take awhile.
Below is an example of the code i'm currently using.
Sub PrintEmbeddedCharts()
Dim ChartList As Integer
Dim X As Integer
' Variable chartlist stores a count of all embedded charts.
ChartList = ActiveSheet.ChartObjects.Count
' Increments the counter variable 'X' in a loop.
For X = 1 To ChartList
' Selects the chart object.
ActiveSheet.ChartObjects(X).Select
' Makes chart active.
ActiveSheet.ChartObjects(X).Activate
' Prints one copy of active chart.
ActiveChart.PrintOut Copies:=1
Next
End Sub
7 sheets with 45+ pre-made charts. Some have data but most don't. The current
code I have counts how many charts there are on the sheet, selects,
activates, and prints them all the way I like. Thing is I'd like it to print
only the charts with data in them.
I thought that a code could be made that checks the source range of the
chart for numbers then prints that chart. However because there are 45+
charts and 7 sheets that would take awhile.
Below is an example of the code i'm currently using.
Sub PrintEmbeddedCharts()
Dim ChartList As Integer
Dim X As Integer
' Variable chartlist stores a count of all embedded charts.
ChartList = ActiveSheet.ChartObjects.Count
' Increments the counter variable 'X' in a loop.
For X = 1 To ChartList
' Selects the chart object.
ActiveSheet.ChartObjects(X).Select
' Makes chart active.
ActiveSheet.ChartObjects(X).Activate
' Prints one copy of active chart.
ActiveChart.PrintOut Copies:=1
Next
End Sub