Link to home
Start Free TrialLog in
Avatar of Juan Velasquez
Juan VelasquezFlag for United States of America

asked on

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

Avatar of Phillip Burton
Phillip Burton

Does this not work?

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

        .Axes(2).TickLabels.NumberFormat  = "#,##0"
Avatar of Juan Velasquez

ASKER

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.
Avatar of Rob Henson
Are your Y axis values percentages?

If so, then this should work:

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

Thanks
Rob H
SOLUTION
Avatar of Phillip Burton
Phillip Burton

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks everyone.  I should have been more specific.  I'll split the points.  Thanks again.
I was reading "%" as a wildcard! I'm doing too much SQL Server.