Hide datalabel values below 3 and above minus 3

C

caillou

Hello,
I'am trying to write a macro that hides values below 3 and above -3 BUT without showing the decimals. The code here under works perfectly if numbers have no decimal, and I've tried so many things that I've lost my inspiration...
Could anyone help me on this please
Thanks a lot !!!

..../
With ActiveChar
countSeries = .SeriesCollection.Coun
For iserie = 1 To countSeries
.SeriesCollection(iserie).DataLabels.NumberFormat = "[>=" & value & "];[<-" & value & "]
Next iseri
//...
 
J

Jon Peltier

Try this in your code:

"[>=" & value & "]0;[<-" & value & "]0;"""""

which produces:

[>=3]0;[<=-3]0;""

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______
 
C

Caillou

Waw
Thank you, it is already much better, the only thing now is that the "-" signs of the Datalebel stay on the chart without their number (sign should dissapear too)... Do you know where I can find documentation about how to use those "codes" to format numbers, are they rules somewhere about that
Thanks a lot for your help!
 
J

Jon Peltier

Okay, this time I actually tested it first, what a concept. The number
format you want is:

[>=3]0;[<=-3]0;

or in VBA:

"[>=" & value & "]0;[<-" & value & "]0;"

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______
 
C

caillou

Thanks a lot, it works perfectly... all of this because a ";" was missing
Thanks again for your help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top