How to set Y axis formatting to zero places.

I'm creating a chart via vba from within Access using late binding.  I am able to create the chart but the Y axis is displaying the percentage values to 2 places.  I tried setting it to "%00" but it is putting adding a zero to the zero value so that it appears like "%00"  .  I am also trying to display the y value for each bar within their respective bars.

With objXlChart
        .ChartType = 52
        .SetSourceData Source:=Range("PercentageAvailByPlanner!$A$1:$B$11")
        
        .PlotBy = 2
        '.Location where:=2, Name:="Percent Available By Planner"
        .HasTitle = True
        .HasLegend = True
        .Axes(2).TickLabels.NumberFormat  = "%00"    


    End With

Open in new window

chtullu135Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Rob HensonConnect With a Mentor Finance AnalystCommented:
I was merely assuming % by the use of %00 in the question.
0
 
Phillip BurtonDirector, Practice Manager and Computing ConsultantCommented:
Does this not work?

        .Axes(2).TickLabels.NumberFormat  = "0"
0
 
Phillip BurtonDirector, Practice Manager and Computing ConsultantCommented:
or

        .Axes(2).TickLabels.NumberFormat  = "#,##0"
0
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

 
chtullu135Author Commented:
Hello Phillip,
I was working on the problem and I came up with .Axes(2).TickLabels.NumberFormat = "%##0".  I tried "#,##0" when I read your post, but it displayed the value rounded to the most significant digit so that %100 appeared as 1  I think that is more to do with how the source data is set.  However, your solution was helpful.  Thanks.
0
 
Rob HensonFinance AnalystCommented:
Are your Y axis values percentages?

If so, then this should work:

.Axes(2).TickLabels.NumberFormat  = "0%"

Thanks
Rob H
0
 
Phillip BurtonConnect With a Mentor Director, Practice Manager and Computing ConsultantCommented:
It wasn't obvious to me that your figures were percentages.

If they were, then Rob's answer should work.

It doesn't round it to the most significant digit. It rounds it to zero decimal places, which was what was requested.
0
 
chtullu135Author Commented:
Thanks everyone.  I should have been more specific.  I'll split the points.  Thanks again.
0
 
Phillip BurtonDirector, Practice Manager and Computing ConsultantCommented:
I was reading "%" as a wildcard! I'm doing too much SQL Server.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.