select chart vba

orsm6

Active Member
Joined
Oct 3, 2012
Messages
496
Office Version
  1. 365
Platform
  1. Windows
Hi all - I am scratching my head on this one. My boss made a document that has easily 50 or so chart sheets. He made a portal page with buttons to jump from chart to chart and back to portal to make it easier. somehow, all of the names he gave the sheets have reverted back to saying Chart1, Chart2 etc etc...

I had to then fix the macros. but now a few weeks later all of the macros are not working again and the Chart Sheet names have changed again... now Chart1 and somehow changed to Chart89, then Chart90 etc etc.

I did some googling to see if I could just activate the chart only by object... not the sheet name.

this is the code i used:
Code:
Sub Plant_GE_Weekly(): Charts(3).Activate: End Sub

but i have run into a problem.
when i assign the macro above to Object Chart3 (Chart89) it for some reason takes me to Chart18 (Chart91)


why would that be?
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Charts(3).Activate

The above code refers to the chart sheet by index number, that being the 3rd chart sheet in the collection. So, let's say that you have 3 chart sheets, and they're named Chart89, Chart90, Chart91, and that they are in that order. In this case, Charts(1) refers to Chart89, Charts(2) refers to Chart90, and Charts(3) refers to Chart91.
 
Upvote 0

Forum statistics

Threads
1,215,022
Messages
6,122,726
Members
449,093
Latest member
Mnur

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