how do we ensure that floating point numbers in cells dont get truncated or rounded off. For example if cell A1has 5.69, Excel automatically changes it to 5.7. How do we stop Excel from doing this and retain a1 as 5.69 only. All this should be done using VBA code only.
VBA Excel code to format floating point numbers
-
-
Hi
Dreamboat posted on your other feed http://www.ozgrid.com/forum/viewthread.php?tid=347
Did you find this useful?
You have moved the feed on and requested VBA approach, the manual method is not to long winded, are you sure you need VBA.
Post back and ill try to provide some script for you if needed
Kindest possible regards
Jack in the UK
-
Hi Jack!
I need to do this via code ONLY.
how do we ensure that floating point numbers in cells dont get truncated or rounded off. For example if cell A1has 5.69, Excel automatically changes it to 5.7. How do we stop Excel from doing this and retain a1 as 5.69 only. All this should be done using VBA code only.Further, if range("b6:bz100") contain numbsers, all the cells in this range should be tested and they should retain their floating points as they are.Sorry to trouble u Jack, but could u please do this for me?
Thank u
-
Public Sub Conv_()
Dim DecRng As Range
Dim Rcells As Range
Set Rcells = Range("b6:bz100")
Rcells.NumberFormat = "0.00"
Range("A1").Select
Set Rcells = Nothing
End Sub
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!