Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default ActiveX Chart

I am trying to create a chart in a userform that has the following ranges as
X and Y values:
lastcol = Worksheets("A").Cells(1, 2).End(xlToRight).Column
XValues = Range(Cells(1, 2), Cells(1, lastcol))
YValues = Range(Cells(2, 2), Cells(2, lastcol))

However, I can't figure out how to set up the array for the chart. I have
the following code in my userform. Any help would be greatly appreciated.
Thanks!

Sub Chart_1()
Dim Chart1 As ChChart
Dim Series1 As ChSeries
Dim XValues As Variant
Dim YValues As Variant

ChartSpace1.Clear
Set Chart1 = ChartSpace1.Charts.Add
lastcol = Worksheets("Values").Cells(2, 1).End(xlToRight).Column
XValues = Array(Range(Cells(1, 2), Cells(1, lastcol)))
YValues = Array(Range(Cells(2, 2), Cells(2, lastcol)))
Set Series1 = Chart1.SeriesCollection.Add
With Series1
.Type = chChartTypeLine
.SetData chDimCategories, chDataLiteral, XValues
.SetData chDimValues, chDataLiteral, YValues
End With
End Sub
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ActiveX control with chart Tanihera Charts and Charting in Excel 1 April 11th 06 05:36 PM
both a chart and a gauge (an activeX) Avi Charts and Charting in Excel 1 October 22nd 05 10:15 AM
activeX interfere with chart Avi Excel Programming 0 October 21st 05 09:55 PM
ActiveX control for chart Frank Kabel Excel Programming 0 May 26th 04 05:33 PM
ActiveX Chart Properties in Excel 2000 Peter Huang [MSFT] Excel Programming 0 September 26th 03 08:29 AM


All times are GMT +1. The time now is 05:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"