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

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
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
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,213,544
Messages
6,114,239
Members
448,555
Latest member
RobertJones1986

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
Back
Top