Print every tab which is a chart (or everything but 'data')

Grizlore

Active Member
Joined
Aug 22, 2006
Messages
259
Dear All,

Would someone have such a code?

I am try to print just the charts in a workbooks using VBA

I have a spreadsheet with >28 charts in it, and one data worksheet (called "data).

So either need to print everything apart from the tab called "Data". Or print every tab which is a chart.

Would someone have such a code. I am getting stuck with my code attempts.


Help would be much appreciated
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

FormR

MrExcel MVP
Joined
Aug 18, 2011
Messages
6,535
Office Version
  1. 365
Platform
  1. Windows
This maybe:

Code:
Sub Test()
Dim x As Worksheet
    For Each x In ActiveWorkbook.Worksheets
    
        If x.Name <> "Data" Then x.PrintOut
    
    Next x
End Sub
 

Grizlore

Active Member
Joined
Aug 22, 2006
Messages
259
ummm... not sure why, but your code just prints the "data" tab. Whether i put <> or = "data"

very strange
 

FormR

MrExcel MVP
Joined
Aug 18, 2011
Messages
6,535
Office Version
  1. 365
Platform
  1. Windows
How about:

Code:
Sub Test()
Dim x As Chart
    For Each x In ActiveWorkbook.Charts
        x.PrintOut
    Next x
End Sub
 

Grizlore

Active Member
Joined
Aug 22, 2006
Messages
259
Thanks seems to have fixed it.

Many Thanks


ps - there is and annoying strobing print announcement when flashes on/off, and Application.ScreenUpdating = False doesnt stop it.


pps - Oh yer... welcome to the board.
 

Forum statistics

Threads
1,136,775
Messages
5,677,655
Members
419,708
Latest member
PhilD

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top