Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a numbers saved in a variable of Variant type.
The numbers are 54, 54.3, 55.54. How do i change these into 54.00, 54.30, 55.54? (Is there a function I can use?) Thanks in advance -- -- Thanks Parkin_m |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Parkin_m,
Use the Format Function in VBA Sub test() Dim a As Variant a = 54.3 MsgBox Format(a, "0.00") End Sub If you're expecting to see the formatted value in the worksheet, then you'll need to format the cell. Sub test2() Dim a As Variant a = 54.3 With ActiveSheet.Range("A1") .Value = a .NumberFormat = "0.00" End With End Sub -- Hope that helps. Vergel Adriano "parkin_m" wrote: I have a numbers saved in a variable of Variant type. The numbers are 54, 54.3, 55.54. How do i change these into 54.00, 54.30, 55.54? (Is there a function I can use?) Thanks in advance -- -- Thanks Parkin_m |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Decimal places | Excel Worksheet Functions | |||
Subtracting two 2-decimal place numbers gives result 13-decimal places? | Excel Worksheet Functions | |||
Decimal Places | Excel Discussion (Misc queries) | |||
FIXED 2 DECIMAL PLACES, MUST ENTER ALL ZEROES AFTER DECIMAL POINT. | Excel Discussion (Misc queries) | |||
decimal places | Excel Discussion (Misc queries) |