Skip to content

Instantly share code, notes, and snippets.

@RichPollock
Created January 23, 2013 16:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RichPollock/4609894 to your computer and use it in GitHub Desktop.
Save RichPollock/4609894 to your computer and use it in GitHub Desktop.
Change the data range of an Excel chart without using .Activate
With Sheets("Source Data Sheet Name")
Set ChartXRange = .Range("A1:A10")
Set ChartRange = .Range("B1:B10")
End With
Sheets("Chart Sheet Name").ChartObjects("Chart Name").Chart.SeriesCollection(1).XValues = ChartXRange
Sheets("Chart Sheet Name").ChartObjects("Chart Name").Chart.SeriesCollection(1).Values = ChartRange
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment