dynamic chart range vba

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Dynamic chart range VBA.

Dynamic chart range VBA.

resolvedResolved · Medium Priority · Version 2016

Callum has attended:
Excel Advanced course

Dynamic chart range VBA.

Hello, I have a question about VBA.

I require creating a chart using a particular variable for cities across the UK.

I have set up a macro that generates this chart, however sometimes I am using more cities in one case than another time. When I use the macro, it only creates a table for the number of cities I used to create the initial macro.

What VBA do I need to allow the range to be dynamic, so when I have more rows of data, the chart source range in the macro automatically adjusts to this?

Thank you.

RE: Dynamic chart range VBA.

Hi Callum,

Thank you for the forum question.

Recorded macros cannot handle changes. They can only do exactly what you did, when you recorded it.

Chart VBA is very complicated and depends on a lot of variables (names, ranges, formats, and much more). We have Chart VBA on our Excel VBA Advanced course and you will need the VBA knowledge on advanced level to be able to understand and write the code.

You can reference the whole range by using CurrentRegion and then the chart automatically will update if you have more cities.


Kind regards

Jens Bonde
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
STL - https://www.stl-training.co.uk
98%+ recommend us

London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector

Thu 7 May 2020: Automatically marked as resolved.

 

Training courses

 

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
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Excel tip:

Repeat action

The F4 key will usually repeat your last action. e.g. delete a row, then select another row and press F4 to delete again.

View all Excel hints and tips


Server loaded in 0.08 secs.