Error message on Activechart.XYGroups

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This statement won't execute....

ActiveChart.XYGroups = "=" & strDataSheet & "!R" & _
Trim(Str(intBegRow)) & "C" & Trim(Str(intBegColumn)) & ":R" & _
Trim(Str(intEndRow)) & "C" & Trim(Str(intEndColumn))

Error Message: Method XYGroups of Objectchart failed. Error 1004.

Any ideas?
 
First, ActiveChart.XYGroups returns a collection of all the XYGroups in the
chart; you need to specify the index to get a specific group - if there is
only one group it would be ActiveChart.XYGroups(1). But even then you aren't
ready to set the range because the ChartGroup itself is an object - the
actual points are in the SeriesCollection. The whole thing would be:

ActiveChart.XYGroups(1).SeriesCollection(1).Values (for the Y Values)
ActiveChart.XYGroups(1).SeriesCollection(1).XValues (for the X Values)
 
It still doesn't work. The following is what I used...

ActiveChart.XYGroups(1).SeriesCollection(1).XValues = "=MASTER!$B$1:$E$1"

Help.
 
Try this: ActiveChart.XYGroups(1).SeriesCollection(1).XValues =
"='MASTER'!$B$1:$E$1" (note the single quotes around the sheet name)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top