View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave D-C[_3_] Dave D-C[_3_] is offline
external usenet poster
 
Posts: 176
Default Excel Macro for Charts

I think you need
Sheet4!A8,Sheet4!A15,Sheet4!A23
instead of
Sheet4!A8,A15,A23
Dave D-C

wrote:
I am trying to create a Macro to create some charts and I am receiving
and error:

Run Time Error '1004'
Unable to set the XValues property of the Series class

The following is my code

Charts.Add
ActiveChart.ChartType = xlLineMarkers
ActiveChart.Location Whe=xlLocationAsObject, Name:="Sheet5"
ActiveChart.SetSourceData
Source:=Sheets("Sheet4").Range("A3:A23,C3:C23") , _
PlotBy:=xlColumns
ActiveChart.SeriesCollection(1).XValues = "=(Sheet4!A8,A15,A23)"
ActiveChart.SeriesCollection(1).Values = _
"=(Sheet4!C9,C16,C24)"
ActiveChart.SeriesCollection(1).Name = "=Sheet4!A2"

All of the referenced cells have data in worksheet. The Macro is ran
from sheet5

Thank you for all of your help