Locating excel graph by graph name (VB)

nikulina

New Member
Joined
Apr 28, 2008
Messages
25
Hi,

I have lots of graphs in a worksheet.

Im trying to find a way or some code to locate a given graph by its name in a worksheet/workbook and then selecting it so the user can view.

So input is a graph name;
Output is viewing the graph

Thankyou in advance for any help
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Here is some code to give you a starting point. You will see that Chart sheets and worksheets with embedded charts need to be handled differently.

Sub test()
Dim ws As Worksheet
Dim objChartObject As ChartObject
Dim objCht As Chart
'
For Each ws In ActiveWorkbook.Worksheets
'Verify if there is a chart object
If ws.ChartObjects.Count > 0 Then
For Each objChartObject In ws.ChartObjects
MsgBox objChartObject.Chart.Name
Next objChartObject
End If
Next ws
' Now check CHART sheets:
For Each objCht In ActiveWorkbook.Charts
MsgBox objCht.Name
Next objCht
Set ws = Nothing
Set objChartObject = Nothing
Set objCht = Nothing
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,732
Members
448,987
Latest member
marion_davis

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