Entering a 30 digit number

  • Thread starter Thread starter Jay
  • Start date Start date
J

Jay

I want to insert a 30 digit number in a cell. When i
insert the number excel rounds it off. Is there any way i
can display the 30 digit number without it being rounded
off?
For Eg. if i enter 123456789123456789123456789 in a cell
Excel rounds it off to 1.23456789123456E+26.

Which property will I have to set if i am using an excel
object in my VB code??
 
You need to either format the cell as text, or prefix it with an apostrophe, as Excel will only
recognise 15 significant digits on a number. Converting it to text will increase that to the
relevant string limits.
 
ActiveCell.NumberFormat = "@"
activecell.Value = "123456789123456789123456789"

or

ActiveCell.NumberFormat = "@"
varr = cdec("123456789123456789123456789")
activecell.Value = cStr(varr)
 
Back
Top