Archive of Mr Excel Message Board

Back to Forms in Excel VBA archive index
Back to archive home

16 digit numbers
Posted by Bob Camacho on June 20, 2001 11:03 AM
Can someone tell me how to get Excel to accept a 16 digit or larger number into a single cell? After 15 digits, Excel replaces all digits with 0.
Example:
1111111111111111 reads 1111111111111110
999999999999999999 reads 999999999999999000

Re: 16 digit numbers - format cell as text
Posted by mseyf on June 20, 2001 11:40 AM
you can try to either format the cell as text (Format>Cell>Number) or start the number with an apostrophe.

Re: 16 digit numbers - format cell as text
Posted by Bob on June 20, 2001 2:06 PM

Re: 16 digit numbers - format cell as text
Posted by Mark W. on June 20, 2001 3:28 PM
> ...but I cannot use the number as a number.
Yes, you can... =REPT("1",16)+20000000000 equals
1.11113+E15. The arthimetic operator coerces the
text value into a numeric.

I Had the same problem, this is what I did.
Posted by Jerid on June 21, 2001 11:38 AM
Change to fit your needs.
Just format the cell as Text, click the cell and run this Macro.
Sub AddOne()
Dim vTemp1 As Variant
Dim vTemp2 As Variant
vTemp1 = CDec(ActiveCell.Value
vTemp2 = vTemp1 + 1
ActiveCell.NumberFormat = "@"
ActiveCell.Value = CStr(vTemp2)
End Sub
I hope this helps
Jerid

This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our
online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.