Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Please help -- why do the last two lines cause Error 438 "Object
doesn't support this property or method"? Dim rngXValues As Range, rngValues As Range Set rngXValues = Range(Cells(12, 8).Cells, Cells(intLastRow, 8).Cells) rngXValues.Select Set rngValues = Range(Cells(12, intAskColumn).Cells, Cells(intLastRow, intAskColumn).Cells) rngValues.Select Charts.Add ActiveChart.Name = "MyChart" ActiveChart.ChartType = xlXYScatter ActiveChart.SetSourceData Source:=Sheets("Data").rngValues, PlotBy:=xlRows ActiveChart.SeriesCollection(1).XValues = Worksheets("Data").rngXValues The rng.Select statements work fine, so I know the ranges exist and are correct. So what is the proper way to set the SourceData and XValues properties? Thanks. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Use the Worksheet object when you set the ranges...
Set rngValues = Worksheets("Data").Range(Cells(12, intAskColumn), _ Cells(intLastRow, intAskColumn)) Then use the range object as the location... ActiveChart.SetSourceData Source:=rngValues, PlotBy:=xlRows If you have more than one sheet to reference, it is best to always qualify ranges with the correct sheet. -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware wrote in message Please help -- why do the last two lines cause Error 438 "Object doesn't support this property or method"? Dim rngXValues As Range, rngValues As Range Set rngXValues = Range(Cells(12, 8).Cells, Cells(intLastRow, 8).Cells) rngXValues.Select Set rngValues = Range(Cells(12, intAskColumn).Cells, Cells(intLastRow, intAskColumn).Cells) rngValues.Select Charts.Add ActiveChart.Name = "MyChart" ActiveChart.ChartType = xlXYScatter ActiveChart.SetSourceData Source:=Sheets("Data").rngValues, PlotBy:=xlRows ActiveChart.SeriesCollection(1).XValues = Worksheets("Data").rngXValues The rng.Select statements work fine, so I know the ranges exist and are correct. So what is the proper way to set the SourceData and XValues properties? Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
setting XValues property when charting using macros | Charts and Charting in Excel | |||
error in XValues | Excel Programming | |||
Error when setting chart Axis value | Excel Programming | |||
Setting chart series XValues in foreign language | Excel Programming | |||
Chart Setting Xvalues | Excel Programming |