Format graph axis to percentage

boerbende

Ben
Local time
Today, 09:17
Joined
Feb 10, 2013
Messages
339
Dear readers

I have searched on the internet and tried many things, it seems so easy, but I can't get it to work. How can I change with VBA the Y axis of a graph to percentage?

sqlstr = simple sql giving with date, value

Graph47.RowSource = sqlstr

I can give the axes min/maximumscales
.Axes(2, 1).MinimumScale = frm_MinscaleY

set the colors and weights
.seriescollection(1).Border.Color = graphcolor
.seriescollection(1).Border.Weight = Lineweight
.seriescollection(1).MarkerSize = MarkerWeight
.seriescollection(1).MarkerBackgroundColor = graphcolor

But everything I try to set the axis to percentage does not work...
No failure message, but nothing happens

Who knows the proper code to do this?

I have tried multiple things
.seriescollection(1).datalabels.numberformat = "0,0%"
.seriescollection(1).datalabels.numberformat = "#,#%"
.seriescollection(1).numberformat = "percentage"
.seriescollection(1).numberformat = "0,0%"
.SeriesCollection(1).tickLabels.NumberFormat = "%"
and a lot more....
hope anybody can give me a clue

Many thanks

Ben de Boer
 
Multiple hours of debugging due to one minor typing failure

.Axes(2, 1).tickLabels.NumberFormat = "0.0%"
does the job

.Axis(2, 1).tickLabels.NumberFormat = "0.0%"
does not work
 

Users who are viewing this thread

Back
Top Bottom