Solved

How to set Y axis formatting to zero places.

Posted on 2015-01-26
8
96 Views
Last Modified: 2015-01-27
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

0
Comment
Question by:chtullu135
  • 4
  • 2
  • 2
8 Comments
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40570832
Does this not work?

        .Axes(2).TickLabels.NumberFormat  = "0"
0
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40570834
or

        .Axes(2).TickLabels.NumberFormat  = "#,##0"
0
 

Author Comment

by:chtullu135
ID: 40570884
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
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 33

Expert Comment

by:Rob Henson
ID: 40570888
Are your Y axis values percentages?

If so, then this should work:

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

Thanks
Rob H
0
 
LVL 24

Assisted Solution

by:Phillip Burton
Phillip Burton earned 250 total points
ID: 40572283
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
 
LVL 33

Accepted Solution

by:
Rob Henson earned 250 total points
ID: 40572398
I was merely assuming % by the use of %00 in the question.
0
 

Author Closing Comment

by:chtullu135
ID: 40572729
Thanks everyone.  I should have been more specific.  I'll split the points.  Thanks again.
0
 
LVL 24

Expert Comment

by:Phillip Burton
ID: 40572732
I was reading "%" as a wildcard! I'm doing too much SQL Server.
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question