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 » Changing Multiple Axis Labels
Changing Multiple Axis Labels
Resolved · High Priority · Version 2010
Mark has attended:
Excel VBA Intro Intermediate course
Excel Advanced - For Power Users course
Excel PowerPivot course
Excel Dashboards for Business Intelligence course
Changing Multiple Axis Labels
Hi,
I'm trying to write a sub routine that will work through each chart on a worksheet and change the vertical axis labels to the format code £##,##0,,""m"", however it keeps debugging though on the 'For Each cht In ActiveSheet.ChartObjects' line and I'm not sure why?
Sub format_turnover()
Dim cht As Chart
For Each cht In ActiveSheet.ChartObjects
cht.Axes(xlValue).Select
Selection.TickLabels.NumberFormat = "£##,##0,,""m"""
Next cht
End Sub
RE: Changing Multiple Axis Labels
Hi Mark,
Thank you for the forum question.
Yes it is not always easy to work with charts in VBA.
Please have a look at the codes below. I have created two codes both should work with your charts.
Sub format_turnover()
Dim cht As ChartObject
With ActiveSheet
For Each cht In .ChartObjects
cht.Select
ActiveChart.Axes(xlValue).Select
Selection.TickLabels.NumberFormat = "£ #,##0.00 ""M"""
Next cht
End With
End Sub
Sub format_turnover()
For i = 1 To ActiveSheet.ChartObjects.Count
ActiveSheet.ChartObjects(i).Activate
ActiveChart.Axes(xlValue).Select
Selection.TickLabels.NumberFormat = "£ #,##0.00 ""M"""
Next i
End Sub
Please let me know if it is not working.
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
Fri 17 Apr 2015: Automatically marked as resolved.
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:Manually wrapping textTo manually wrap text, use the shortcut key Alt+Enter. |