VBA - Obtaining source-range of a chart

PiVi

New Member
Joined
Jan 11, 2009
Messages
6
Hello there,

I'm new here.

The reason I became member is that I am totaly stuck in my attempt to the following:
I produced a VBA macro in Excel with the intention to examine a test pupils of me have made. One of the items to examine is the chart they have to make.
To control whether or not they picked the right source-range for this chart I have to retrieve the used source-range. Btw it's a pie-chart.
Does anyone know what VBA-code I can use for this problem?

All suggestions are welcome!

PiVi
 

Some videos you may like

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
23,254
Something like
Code:
MsgBox ActiveSheet.ChartObjects(1).Chart.SeriesCollection(1).Formula
 

PiVi

New Member
Joined
Jan 11, 2009
Messages
6
Thanks, Mickerickson

Especially the part 'Formula' was the thing i needed.
The part 'Chartobjects(1).Chart' produced error 1004.
I try to translate from the Dutch version: Property ChartObjects of class Chart cannot be collected.

But without that part it works just fine!
Tanks again.

PiVi
 

mikerickson

MrExcel MVP
Joined
Jan 15, 2007
Messages
23,254
That syntax is for a chart on a worksheet. The syntax is different if the chart is its own sheet.
Code:
MsgBox Sheets("Chart1").SeriesCollection(1).Formula
 

Watch MrExcel Video

Forum statistics

Threads
1,095,365
Messages
5,444,030
Members
405,261
Latest member
Khauff

This Week's Hot Topics

Top