Print Chart Worksheet

  • Thread starter Thread starter Blue
  • Start date Start date
B

Blue

I have a list of chart worksheets in F5 down, thanks to peps here for code.

I want to print each chart if there is an Y in the cell next to chart tab
name.
F G
F5 Chart1 Y print
F6 Chart 2 don't print
F7 Chart 3 Y print
etc

Something like if G = Y print chart named in F, repeat to end of F

Thanks for help Blue
 
Blue -

Untested but should do the trick.

Sub PrintChartSheets()
Dim rChtName as Range

' first cell with chart name
Set rChtName = ActiveSheet.Range("F5")

Do Until Len(rChtName.Value) = 0
' check whether to print
If rChtName.Offset(0, 1).Value = "Y" then
' skip if chart sheet doesn't exist
On Error Resume Next
ActiveWorkbook.Charts(rChtName.Value).PrintOut
On Error Goto 0
End If

' advance cell
Set rChtName = rChtName.Offset(1)
Loop

End Sub


- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top