I think it would be very simple to set up that macro, but I have no idea in this filed.

This is the problem:

My workbook contains 10 charts and 6 of them are UNHIDDEN. The rest is hidden.

My macro should print ONLY THE ACTIVE (open) CHARTS.

Thank you in advance

Re: Macro print actice charts


Hi hysenlici

I just wrote a simple procedure that print out only a visible chart.

I afraid that it works well on your pc. you'll see how to work the codes with line-by-line comment , '//

here it is:

Sub PrintChart()
Dim s As Worksheet '// containing your charts
Dim t As Worksheet '// temporary sheet holding a pasted chart to print out

Dim chtobj As ChartObject '// chart object of s
Dim chtCopied As ChartObject '// chart object of t

On Error Resume Next

Set s = Sheet1 '// you have to specify the worksheet that holds 10 charts
Set t = Worksheets.Add '// a brand new worksheet that contains a pasted chart

For Each chtobj In s.ChartObjects '// looping among the charts of s

If chtobj.Visible Then '// check the chart visible

chtobj.PrintObject = True '// set up the chart printable
chtobj.Copy '// save chart into the clipboard
t.Range("A1").PasteSpecial xlPasteAll '// paste to the new sheet
t.PrintOut '// print out the pasted chart

'// after printing, delete the chart on new sheet
For Each chtCopied In t.ChartObjects

End If


'// disable the warning msgbox whenever you delete a worksheet
Application.DisplayAlerts = False

'// delete the temporary sheet

'// restore the warning setting
Application.DisplayAlerts = True
End Sub

Re: Macro print actice charts



That worked in my PC.

Thank you very much!!!