Can I get a number in such a format as it should be?

O

OrientalPearl

Howday everyone,

Just a quick question here. How can I disable scientific notation to
kick in when manipulating a variable in VBA, i.e. to display/use/...
its value as 123456789123456789 as exactly it should be rather than
1.23E+18. Basically scientific notation needs to be totally switched
off here. The variable is of type Single by the way.

Many thanks
Frank
 
G

Guest

Try the Format() formula. Something like:

Let vMyVar = Format(vMyVar, "00000000000000000.0")

HTH,
tchid2
 
O

OrientalPearl

Thanks for the solution, tchid2. The other thing I didn't make clear is
that it's a variable, i.e. its value is unknown, can be 999 or
999999999999999999999999. So Im not exactly sure whether Format() can
do this or not since I dont really know how many 0s I should place
there. Is another more generic way to totally toss scientific notation
out of the window regardless of the number of digits??

Appreciate your help!
Frank
 
O

OrientalPearl

I have figured out the solution myself, which is provided here and
hopefully will of some help to others in the future:
It's not complicated really...just need to declare the variable 'AS
Variant', which will keep the numeric representation all the time (well
before its boundary values are exceeded)
Good luck to everyone involved in VBA
 

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