![]() |
decimal places????
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 |
decimal places????
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 |
All times are GMT +1. The time now is 03:42 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com