ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Referencing worksheet CODENAME in a chart object. (https://www.excelbanter.com/excel-discussion-misc-queries/13054-referencing-worksheet-codename-chart-object.html)

Bing

Referencing worksheet CODENAME in a chart object.
 
Hi all,

I have an excel chart (generated by the Chart Wizard) that references the
worksheet NAME. For example, when i right click on chart, and select 'Source
Data' i see the 'Data Range' reference the worksheet NAME as follows:

='Main Menu'!$D$13:$D$14,'Main Menu'!$E$13:$E$14

But the 'Main Menu' worksheet has a CODE NAME of of "Main". I've tried
numerous permutations but i just cannot get this chart's Data Range to
reference the worksheet CODE NAME instead.

Can anyone help?

Thanks


Dave Peterson

How about:

ActiveChart.SetSourceData Source:=Main.Range("d13:e14")

When I recorded a macro, the range was combined into one reference.

Even this way worked:

ActiveChart.SetSourceData Source:=Main.Range("A1:A21,C1:C21"), _
PlotBy:=xlColumns



Bing wrote:

Hi all,

I have an excel chart (generated by the Chart Wizard) that references the
worksheet NAME. For example, when i right click on chart, and select 'Source
Data' i see the 'Data Range' reference the worksheet NAME as follows:

='Main Menu'!$D$13:$D$14,'Main Menu'!$E$13:$E$14

But the 'Main Menu' worksheet has a CODE NAME of of "Main". I've tried
numerous permutations but i just cannot get this chart's Data Range to
reference the worksheet CODE NAME instead.

Can anyone help?

Thanks


--

Dave Peterson


All times are GMT +1. The time now is 05:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com