Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88054

VBA - How to choose right number of decimals, based on chart dataseries?

$
0
0

I am working on a macro for formatting charts. I got stuck at choosing a number of decimals (0 or 1) for data labels and y-axis -> if the chart line is "flat" (low volatility) I want to see one decimal point. I've tried to base the calculations on variance, average etc. but nothing seems to work at all.

'$'

' --- DECIMALS DISPLAYED --- 'mn/mx - minimum/maximum in dataseries kustomFormat = IIf(Abs(mn) / (Abs(mx) + 0.0001) > 0.6, "0.0", "0") ActiveChart.Axes(xlValue).TickLabels.NumberFormat = kustomFormat On Error Resume Next For i = 1 To ActiveChart.SeriesCollection.Count ActiveChart.FullSeriesCollection(i).DataLabels.NumberFormat = kustomFormat Next i

'$'


Viewing all articles
Browse latest Browse all 88054

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>