Return amount with various number of decimals

S

staeri

I have a calculating function in VBA which returns an amount and I have
problems regarding how to show the correct number of decimals.

If the returning value has no decimal, it should show no decimal.
If the returning value has 1 decimal, it should show 1 decimal.
If the returning value has 2 decimals, it should show 2 decimals.
If the returning value has 3 decimals or more, it should show 3
decimals.

How can I solve this?

Regards,

S
 
T

Tom Ogilvy

format the cell as General and make the column wide enough to display as many
decimals as you would ever expect to see.
 

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