Identify / return name of Visible Chart Only

Mark.B

Board Regular
Joined
Jun 14, 2004
Messages
136
Hi everyone,

Within a worksheet there are 2 embedded charts. one of these is visible the other is not. Using Vb, how can i identify the name of the chart which is visible ? and can I modify the chart (i.e. change the chart type) without activating it ?

Any help would be greatly appreciated.
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

NdNoviceHlp

Well-known Member
Joined
Nov 9, 2002
Messages
2,958
Here's a start Mark. I don't think you can change a chart type without activatig it? Dave
Code:
Sub test()
Dim sh As Worksheet, ChrtCnt As Integer
Set sh = ActiveSheet
For ChrtCnt = 1 To sh.ChartObjects.Count
If sh.ChartObjects(ChrtCnt).Visible = True Then
MsgBox "Chart: " & sh.ChartObjects(ChrtCnt).Chart.Name & " is visible"
End If
Next ChrtCnt
End Sub
 

Mark.B

Board Regular
Joined
Jun 14, 2004
Messages
136
Here's a start Mark. I don't think you can change a chart type without activatig it? Dave
Code:
Sub test()
Dim sh As Worksheet, ChrtCnt As Integer
Set sh = ActiveSheet
For ChrtCnt = 1 To sh.ChartObjects.Count
If sh.ChartObjects(ChrtCnt).Visible = True Then
MsgBox "Chart: " & sh.ChartObjects(ChrtCnt).Chart.Name & " is visible"
End If
Next ChrtCnt
End Sub

Brilliant. Thanks Dave, with a slight tweak I can get this to work exactly how i need it to. Really really appreciate the help.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,193
Messages
5,768,770
Members
425,492
Latest member
blueexcel123

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