Lavina

Board Regular
Joined
Dec 18, 2018
Messages
75
Hello guys,

im creating visual representation of my data, and i want to create charts.
The code to create the chart is:
Range("T1:T32,V1:V32,X1:X32").Select
ActiveSheet.Shapes.AddChart2(201, xlColumnClustered).Select
ActiveChart.SetSourceData Source:=Range( _
"'test'!$T$1:$T$32,'test'!$V$1:$V$32,'test'!$X$1:$X$32" _
)
ActiveChart.FullSeriesCollection(1).ChartType = xlColumnClustered
ActiveChart.FullSeriesCollection(1).AxisGroup = 1
ActiveChart.FullSeriesCollection(2).ChartType = xlLine
ActiveChart.FullSeriesCollection(2).AxisGroup = 1

I want to create graphs for each month of data, so i will need position them properly, to achieve that i need to name each of my charts.
(since they will all be the same size, i plan to set their positions into 12 static positions for each month, is there a better idea?)

i can see the chart name with:
ActiveChart.Name, but the name is based on the tab name + incremental number "chart"
If i try to update it with a value:
ActiveChart.Name = "test"
I get the error: Out of memory
Never had this issue before, what am i doing wrong?

Also, is there any way to control the incremental number? If i could reset it every time my macro is run i could use it, but right now it keeps incrementing every time a chart is made and to reset the number i have to remake the tab
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

pgc01

MrExcel MVP
Joined
Apr 25, 2006
Messages
19,884
...
ActiveChart.Name = "test"
I get the error: Out of memory

Hi

For a chart embedded in a worksheet use:

Code:
ActiveChart.Parent.Name = "test"


Also, is there any way to control the incremental number? If i could reset it every time my macro is run i could use it, but right now it keeps incrementing every time a chart is made and to reset the number i have to remake the tab

No.
That's not a problem for me because I never use that incremental number, that tells me nothing.
I always name the chart with a meaningful name, that I then use in the code.
 
Last edited:

Lavina

Board Regular
Joined
Dec 18, 2018
Messages
75
Ah, parent, now I've read into it and understand the difference. Thank you very much!



I was planning to only use them as a last resort, no need now!
 

Watch MrExcel Video

Forum statistics

Threads
1,129,591
Messages
5,637,288
Members
416,963
Latest member
samfuge

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
Top