PC Review Forums Newsgroups Microsoft Excel Microsoft Excel Charting setting XValues property when charting using macros

Reply

setting XValues property when charting using macros

 
Thread Tools Rate Thread
Old 31-03-2006, 04:48 PM   #1
=?Utf-8?B?cmhzaWFv?=
Guest
 
Posts: n/a
Default setting XValues property when charting using macros


Hello,

I hope this message finds you well. I had a quick question concering
XValues syntax.

I am trying to set the XValues of series 3 in Chart 1 of Sheet1. I am
trying to use the values within cells C33 to C35 for the XValues.

The code I am using is listed as follows:

ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection.NewSeries

ActiveChart.SeriesCollection(3).XValues =
Worksheets("Sheet1").Range(.Cells(33, 3), .Cells(35, 3))


Apparently, there is compile error when I use .Cell in my code. The error
message is: Invalid or unqualified reference. I've checked the syntax
against the VB reference manuals, and it appears correct.

Does anybody have any ideas? Thanks and have a wonderful day!
  Reply With Quote
Old 31-03-2006, 04:52 PM   #2
Andy Pope
Guest
 
Posts: n/a
Default Re: setting XValues property when charting using macros

Hi,

You would use .Cells within a With block. The following is untested but
the syntax should work.

With Worksheets("Sheet1")
ActiveChart.SeriesCollection(3).XValues =
.Range(.Cells(33, 3), .Cells(35, 3))
End with

Cheers
Andy

rhsiao wrote:
> Hello,
>
> I hope this message finds you well. I had a quick question concering
> XValues syntax.
>
> I am trying to set the XValues of series 3 in Chart 1 of Sheet1. I am
> trying to use the values within cells C33 to C35 for the XValues.
>
> The code I am using is listed as follows:
>
> ActiveSheet.ChartObjects("Chart 1").Activate
> ActiveChart.PlotArea.Select
> ActiveChart.SeriesCollection.NewSeries
>
> ActiveChart.SeriesCollection(3).XValues =
> Worksheets("Sheet1").Range(.Cells(33, 3), .Cells(35, 3))
>
>
> Apparently, there is compile error when I use .Cell in my code. The error
> message is: Invalid or unqualified reference. I've checked the syntax
> against the VB reference manuals, and it appears correct.
>
> Does anybody have any ideas? Thanks and have a wonderful day!


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
  Reply With Quote
Old 07-04-2006, 04:02 PM   #3
=?Utf-8?B?cmhzaWFv?=
Guest
 
Posts: n/a
Default Re: setting XValues property when charting using macros

Mr. Pope,

I'm not sure if you check old threads, but I wanted to thank you for your
help. Your tip was right on! Thanks!



"Andy Pope" wrote:

> Hi,
>
> You would use .Cells within a With block. The following is untested but
> the syntax should work.
>
> With Worksheets("Sheet1")
> ActiveChart.SeriesCollection(3).XValues =
> .Range(.Cells(33, 3), .Cells(35, 3))
> End with
>
> Cheers
> Andy
>
> rhsiao wrote:
> > Hello,
> >
> > I hope this message finds you well. I had a quick question concering
> > XValues syntax.
> >
> > I am trying to set the XValues of series 3 in Chart 1 of Sheet1. I am
> > trying to use the values within cells C33 to C35 for the XValues.
> >
> > The code I am using is listed as follows:
> >
> > ActiveSheet.ChartObjects("Chart 1").Activate
> > ActiveChart.PlotArea.Select
> > ActiveChart.SeriesCollection.NewSeries
> >
> > ActiveChart.SeriesCollection(3).XValues =
> > Worksheets("Sheet1").Range(.Cells(33, 3), .Cells(35, 3))
> >
> >
> > Apparently, there is compile error when I use .Cell in my code. The error
> > message is: Invalid or unqualified reference. I've checked the syntax
> > against the VB reference manuals, and it appears correct.
> >
> > Does anybody have any ideas? Thanks and have a wonderful day!

>
> --
>
> Andy Pope, Microsoft MVP - Excel
> http://www.andypope.info
>

  Reply With Quote
Old 07-04-2006, 04:16 PM   #4
Andy Pope
Guest
 
Posts: n/a
Default Re: setting XValues property when charting using macros

Thanks for letting us know.

Cheers
Andy

rhsiao wrote:
> Mr. Pope,
>
> I'm not sure if you check old threads, but I wanted to thank you for your
> help. Your tip was right on! Thanks!
>
>
>
> "Andy Pope" wrote:
>
>
>>Hi,
>>
>>You would use .Cells within a With block. The following is untested but
>>the syntax should work.
>>
>>With Worksheets("Sheet1")
>> ActiveChart.SeriesCollection(3).XValues =
>> .Range(.Cells(33, 3), .Cells(35, 3))
>>End with
>>
>>Cheers
>>Andy
>>
>>rhsiao wrote:
>>
>>>Hello,
>>>
>>>I hope this message finds you well. I had a quick question concering
>>>XValues syntax.
>>>
>>>I am trying to set the XValues of series 3 in Chart 1 of Sheet1. I am
>>>trying to use the values within cells C33 to C35 for the XValues.
>>>
>>>The code I am using is listed as follows:
>>>
>>> ActiveSheet.ChartObjects("Chart 1").Activate
>>> ActiveChart.PlotArea.Select
>>> ActiveChart.SeriesCollection.NewSeries
>>>
>>>ActiveChart.SeriesCollection(3).XValues =
>>>Worksheets("Sheet1").Range(.Cells(33, 3), .Cells(35, 3))
>>>
>>>
>>>Apparently, there is compile error when I use .Cell in my code. The error
>>>message is: Invalid or unqualified reference. I've checked the syntax
>>>against the VB reference manuals, and it appears correct.
>>>
>>>Does anybody have any ideas? Thanks and have a wonderful day!

>>
>>--
>>
>>Andy Pope, Microsoft MVP - Excel
>>http://www.andypope.info
>>


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off