filmov
tv
Excel VBA UserForm TextBox - How to format number

Показать описание
Excel VBA UserForm TextBox - Learn how to format number
The code used in this video:
Private Sub UserForm_Initialize()
Dim Price As Double
Price = 9
Dim Discount As Double
Discount = 0.25
Dim InStock As Integer
InStock = 1
'General Number-displays a number without thousand separators
txtPrice = Format(Price, "General Number")
'Standard - displays the thousand separators,
'at least one digit to the left of the decimal place,
'and two digits to the right of the decimal place
'txtPrice = Format(Price, "Standard")
'Fixed - displays at least one digit to the left of the decimal place
'and two digits to the right of the decimal place.
'txtPrice = Format(Price, "Fixed")
'txtPrice = Format(Price, "0.00")
'txtPrice = Format(Price, "#,##0.00")
'Currency - displays thousand separators
'two decimal places
'txtPrice = Format(Price, "Currency")
'txtPrice = Format(Price, "$#,##0.00")
'txtDiscount = Format(Discount, "Percent")
'txtDiscount = Format(Discount, "0.00%")
'txtInStock = Format(InStock, "Yes/No")
'txtInStock = Format(InStock, "True/False")
'txtInStock = Format(InStock, "On/Off")
End Sub
The code used in this video:
Private Sub UserForm_Initialize()
Dim Price As Double
Price = 9
Dim Discount As Double
Discount = 0.25
Dim InStock As Integer
InStock = 1
'General Number-displays a number without thousand separators
txtPrice = Format(Price, "General Number")
'Standard - displays the thousand separators,
'at least one digit to the left of the decimal place,
'and two digits to the right of the decimal place
'txtPrice = Format(Price, "Standard")
'Fixed - displays at least one digit to the left of the decimal place
'and two digits to the right of the decimal place.
'txtPrice = Format(Price, "Fixed")
'txtPrice = Format(Price, "0.00")
'txtPrice = Format(Price, "#,##0.00")
'Currency - displays thousand separators
'two decimal places
'txtPrice = Format(Price, "Currency")
'txtPrice = Format(Price, "$#,##0.00")
'txtDiscount = Format(Discount, "Percent")
'txtDiscount = Format(Discount, "0.00%")
'txtInStock = Format(InStock, "Yes/No")
'txtInStock = Format(InStock, "True/False")
'txtInStock = Format(InStock, "On/Off")
End Sub
Комментарии