Hey everyone,
I have a bit of a problem with a printing macro that I hope you guys can solve for me.
Basically the macro I copied from another website fulfills most of my wishes as it prints out all chartsheets from Excel. However, it stops working because there are hidden chartsheets. I wish to embed an option that dynamically skips hidden charts and continues on printing - but my efforts remain fruitless still.
A second parter for this code would be that I want it to specifically target a list of named sheets (regular worksheets) and print those out as well.
As a result the button that the macro is under should print out all visible chartsheets and some named sheets that I've provided the names for in a workbook.
Hope you lot can help out with the struggle!
Thanks a lot in advance.
Kind regards,
Esjesu
I have a bit of a problem with a printing macro that I hope you guys can solve for me.
Basically the macro I copied from another website fulfills most of my wishes as it prints out all chartsheets from Excel. However, it stops working because there are hidden chartsheets. I wish to embed an option that dynamically skips hidden charts and continues on printing - but my efforts remain fruitless still.
A second parter for this code would be that I want it to specifically target a list of named sheets (regular worksheets) and print those out as well.
As a result the button that the macro is under should print out all visible chartsheets and some named sheets that I've provided the names for in a workbook.
Hope you lot can help out with the struggle!
Thanks a lot in advance.
Code:
Option Explicit
Sub PrintCharts()
Application.ScreenUpdating = False
Dim ch As Object
Dim sh As Worksheet
Dim icount As Integer
icount = 0
'Print Charts
For Each ch In ActiveWorkbook.Charts
icount = icount + 1
ch.PrintOut
Next ch
MsgBox "Printing " & icount & " charts from Workbook " _
& ActiveWorkbook.Name & ".", vbInformation, "Print Charts"
Application.ScreenUpdating = True
End Sub
Kind regards,
Esjesu