ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Print Chart Worksheet (https://www.excelbanter.com/excel-programming/321887-print-chart-worksheet.html)

Blue

Print Chart Worksheet
 
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



Jon Peltier[_9_]

Print Chart Worksheet
 
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/
_______


Blue wrote:

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




All times are GMT +1. The time now is 07:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com