ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Text Box Format (https://www.excelbanter.com/excel-programming/276871-re-text-box-format.html)

Tom Ogilvy

Text Box Format
 
Use the Keypress event

Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii = 46 Then Exit Sub
If KeyAscii < 48 Or KeyAscii 57 Then
KeyAscii = 0
End If
End Sub

--
Regards,
Tom Ogilvy

"scrabtree23" wrote in message
...
I have a text box on a user form and I want to format it
so the user has to enter numbers (with a decimal) and the
result needs to be displayed in the text box as currency.
I don't want it to allow text. ???

SDC





All times are GMT +1. The time now is 01:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com