Thread
:
Excel dropping decimal places
View Single Post
#
2
Posted to microsoft.public.excel.programming
Ken Puls
external usenet poster
Posts: 58
Excel dropping decimal places
Are you, by any chance, declaring your variable as the currency type?
Try changing it to a double:
Dim val1 As Currency
val1 = Range("A1").Value
Debug.Print val1
~123.1235
Dim val2 As Double
val2 = Range("A1").Value
Debug.Print val2
~123.123456
Ken Puls, CMA - Microsoft MVP (Excel)
www.excelguru.ca
wrote:
I have a weird problem when trying to grab numbers with more than 4
decimal places.
For example if A1 = 123.123456
If I try to debug.print or use Range("A1") in a calculation, it only
shows: 123.1234
If I directly enter a cell on the spreadsheet like make cell B1 equal
to "=A1", the decimal places stay intact on the spreadsheet. I just
can't figure out how to get all the decimal places into a variable so I
can make a calculation with it.
Any ideas why Excel is dropping the extra decimals when I'm trying to
get the value as a Range?!!
Thanks.
John
Reply With Quote
Ken Puls
View Public Profile
Find all posts by Ken Puls