close

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(quot;Chart 1quot;).Activate
ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection.NewSeries

ActiveChart.SeriesCollection(3).XValues =
Worksheets(quot;Sheet1quot;).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!

Hi,

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

With Worksheets(quot;Sheet1quot;)
ActiveChart.SeriesCollection(3).XValues =
.Range(.Cells(33, 3), .Cells(35, 3))
End with

Cheers
Andy

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

--

Andy Pope, Microsoft MVP - Excel
www.andypope.info

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!
quot;Andy Popequot; wrote:

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

Thanks for letting us know.

Cheers
Andy

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

--

Andy Pope, Microsoft MVP - Excel
www.andypope.info

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()