BigDelGooner
Board Regular
- Joined
- Aug 17, 2009
- Messages
- 197
hi all
I am trying to set the source data range for a chart within VBA because each time the query is run the range will change.
I am using the following code but when it gets to the .setsourcedata line I get an 'application-defined or object-defined' error.
With ActiveChart.Axes(xlValue)
.MinimumScale = Application.WorksheetFunction.Floor(MinScale - 1, 10)
.MaximumScale = Application.WorksheetFunction.Ceiling(MaxScale + 1, 10)
.SetSourceData Source:=Sheets("Report_Indexed").Range(Cells(2, 2), Cells(End_Row, End_Column)), PlotBy:=xlColumns
End With
Any ideas?
I am trying to set the source data range for a chart within VBA because each time the query is run the range will change.
I am using the following code but when it gets to the .setsourcedata line I get an 'application-defined or object-defined' error.
With ActiveChart.Axes(xlValue)
.MinimumScale = Application.WorksheetFunction.Floor(MinScale - 1, 10)
.MaximumScale = Application.WorksheetFunction.Ceiling(MaxScale + 1, 10)
.SetSourceData Source:=Sheets("Report_Indexed").Range(Cells(2, 2), Cells(End_Row, End_Column)), PlotBy:=xlColumns
End With
Any ideas?