Hi, I was wondering if there is any way I can change the index number of chart objects? I know I can change the index number of sheets through VB editor object properties, but I can't find a way to do the same for charts (chart objects are not displayed in the VBAProject excel objects list). Please advise, thank you.
Do you mean index number or do you mean it's name?
How do you change a sheets index?
I'm referring to the chart object's index number, not the chart name. You are able to change the sheet index number through the VB Editor. Under the VBAProject excel objects list, if you select the sheet and click F4, you can edit the (Name) field which will change the sheet index number. However I haven't been able to find a way to do this with charts and I'm not sure if you can even do that.
Change the sheets tab or codename will not changes it's index. Change the order of the sheets will change it's index. 1 possible exception would be if you where using numbers instead of names.
You can not change the Index value of a chart. You can change it's name.
Why do you want to change the index of the chart?
I'm building a macro to alter the formatting of different charts across multiple worksheets. For example, I have worksheets 1, 2, and 3, and in each worksheets I have identical charts A, B, and C. I need to make different formatting adjustments to all the A charts across all 3 sheets, all the B charts across all 3 sheets, and so forth. I can't guarantee the names of these charts will stay the same in the future (model will be run by other users). I was wondering if there is any way I can change the index number of the charts without rebuilding them since Excel numbers the charts based on which one was created first on each sheet, that way the macro can use a loop structure to apply the same set of formatting changes to all the same charts in each sheet. Does that make sense?
The index value is based on creation order and can not be changed.
You either need to give the charts a name that you can then use to reference.
Or if the layout is the same you could check the location of chartobjects.
Thanks for your help!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks