98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Excel VBA - Charts
Excel VBA - Charts
Resolved · Low Priority · Version 2003
Michael has attended:
Excel Advanced course
Excel VBA Intro Intermediate course
Access VBA course
Excel VBA - Charts
Is it possible to amend the 'source data' range with VBA when constructing/updating excel charts ?
RE: Excel VBA - Charts
Hi Michael,
Thank you for your question. Whenever you wish to change any data, you should set it as a Variable. In this case, SourceData should be set as a range variable.
Assuming your sourcedata always start in cell "A1" of worksheet "Sheet 1", see the sample codes below:
====================================
Sub MakeChart()
Dim SourceData As Range
Set SourceData = Range("A1", Range("A1").End(xlToRight).End(xlDown))
Charts.Add
ActiveChart.SetSourceData Source:=SourceData
ActiveChart.Location Where:=xlLocationAsNewSheet
Sheets("Sheet1").Select
End sub
====================================
Hope this is useful
Kind regards,
Katie Woo
Microsoft Certified Trainer
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Sorting data stored in rowsPrimarily Excel is set up to sort data that is stored in columns rather than rows. |