Decimal places on hundreds of Excel graphs

别说谁变了你拦得住时间么 提交于 2020-06-18 12:19:11

问题


If I'm dealing with hundreds of graphs, which are right now automatically setting the y axis, how can I eliminate 10.0%, 20.0%, and make it simply 10%, 20% (a savings of 2 characters)? I'm using Excel 2010, and don't want to mess up automatic formatting since there may be times that I need the percent decimal places, as in unemployment (4.5% is meaningful). Of course, sometimes I graph stuff on the y axis in millions or billions of dollars (but that's a separate question).

Update: I found out that security rules prohibit macros in spreadsheets. Can it be done without macros, by setting a value? Perhaps that is something that the vendor (Microsoft) would do in future years....


回答1:


Right click the Y Axis you want to change. Go to "Format Axis", and click "Number". Here is where you can choose what type (accounting, number, percentage, etc) of formatting you want. Just choose "Percentage" and put "0" for the "Decimal Places".

Macro which will do so for all charts in a worksheet:

Sub Macro2()
Dim obj     As Object
For Each obj In ActiveSheet.ChartObjects
    With obj.Chart.Axes(xlValue)
       .TickLabels.NumberFormat = "0%"
    End With
Next obj

End Sub


来源:https://stackoverflow.com/questions/32459870/decimal-places-on-hundreds-of-excel-graphs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!