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

  • Thread starter Thread starter OrientalPearl
  • Start date Start date
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
 
Try the Format() formula. Something like:

Let vMyVar = Format(vMyVar, "00000000000000000.0")

HTH,
tchid2
 
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
 
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
 
Back
Top