ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Entering a 30 digit number (https://www.excelbanter.com/excel-programming/274545-entering-30-digit-number.html)

Jay[_10_]

Entering a 30 digit number
 
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??

Ken Wright

Entering a 30 digit number
 
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.

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL2K & XLXP

----------------------------------------------------------------------------
Attitude - A little thing that makes a BIG difference
----------------------------------------------------------------------------



"Jay" wrote in message ...
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??




Tom Ogilvy

Entering a 30 digit number
 
ActiveCell.NumberFormat = "@"
activecell.Value = "123456789123456789123456789"

or

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



--
Regards,
Tom Ogilvy


Jay wrote in message
...
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??





All times are GMT +1. The time now is 08:32 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com