Excel VBA UserForm TextBox - How to format number

preview_player
Показать описание
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
Рекомендации по теме
Комментарии
Автор

this is the best unintentional asmr channel on youtube

DaddyContent
Автор

What a nice voice, helped me a lot :)

pratasp
Автор

Hello, thanks for sharing this excellent tutorial video.
Please guide me:
Using a textbox having format "#0.00"
i want that user does not need to press "." and pointer automatically passes to first digit after decimal AFTER filling the positions before decimal.

tayyabatfarms
Автор

I'm trying to find code that shows the numbers not in the currency but in the accounting format, where dashes are in place of zeros and and parenthesis for negative numbers. How do I do that?

venomad
Автор

Help! I am having problems if i format my number then have an equation with the textboxes. Any solution?

bengtlee
Автор

Dear, if possible to help me.
i have userform containing textbox . one of that text boxes receive calculation result as hours and fractions. i want to divert that fractions to minutes.
best regards

mohamedhashem
Автор

hi sir i always watch your video is it possible to find the last three digit ID number in textbox?

bogztv
visit shbcf.ru