View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] bodhi2.71828@gmail.com is offline
external usenet poster
 
Posts: 22
Default error when setting XValues for chart

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.