Solved

# QUICK QUESTION: How do I KEEP trailing zeros?

Posted on 2008-02-01
Medium Priority
269 Views
I have an array Dimmed as Variant.  It has about 25 items in it, mostly integers, strings, and some currency.  I extracted the currency values and displayed them on a Form using CStr(arrArray(x)) but I noticed that the trailing zeros are stripped away.  How do I keep them?

For example:
51.50 becomes 51.5
51.00 becomes 51
51.23 remains 51.23

I want it so that:
51.50 remains 51.50
51.00 remains 51.00

How do I do this?
0
Question by:CoderBboy
• 2

LVL 44

Accepted Solution

Arthur_Wood earned 200 total points
ID: 20803110
format (Value, "#,###.00")  this will keep 2 digits to the right of the decimal point, even if the rightmost is/would be 0)

AW
0

Author Comment

ID: 20803180
The numbers range from 1 to 100,000,000.  How do I know how many # to use?
0

LVL 44

Expert Comment

ID: 20804283
the Format function is smart enough to know the #,###.00 means use the comma separator, regardless of the size of the number, be it 1,000.00 or 1,000,000,000.00 ...
0

## Featured Post

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.