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