graphs

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 » Graphs

Graphs

resolvedResolved · Medium Priority · Version 2007

Peter has attended:
Excel VBA Advanced course

Graphs

How is it possible to change the order of your bar labels in a chart using VBA?

RE: Graphs

Hi Peter,

Thank you for the question.

If you create a chart with 3 series, it could be January, February and March. Copy and paste the code below to a module.

Sub ChangeChart()

Dim iCounter As Integer
Dim vNewOrder As Variant
Dim strOldOrder(1 To 3) As String


vNewOrder = Array(3, 1, 2) ' set the order you want.

For iCounter = 1 To UBound(vNewOrder)

strOldOrder(iCounter) = ActiveChart. _
SeriesCollection(i + 1).Name

Next iCounter
For iCounter = 1 To UBound(vNewOrder)

ActiveChart. _
SeriesCollection(strOldOrder(iCounter)). _
PlotOrder = vNewOrder(iCounter)

Next iCounter


End Sub

In the Array function ( Array(3, 1, 2)) just type the order you want for your series.

I hope that helps.

Kind regards

Jens Bonde
Microsoft Office Specialist Trainer

Tel: 0207 987 3777
Best 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

Read more: https://www.stl-training.co.uk/post-34560-formula-shows-quarters.html #ixzz2wE8kbKnu

 

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:

Page Break Preview in Excel 2010 (Hint/tip)

If you select View then Workbook Views then Page Break Preview, you will be able to view how your Excel spreadsheet will be split across multiple pages when printed. Even better, you can also drag a page break to a new place. Excel will then scale down your entire worksheet to fit the information you want on the pages you want.

View all Excel hints and tips


Server loaded in 0.1 secs.