textbox validation
hi!
i have a multipage within a form. the multipage has several textboxes. some of them use the values of the others textboxes to do math thing, like adds. everything goes wrong when the user capture characters. how can i ensure the user to capture only numbers, integer numbers? tia. |
textbox validation
Hi Begi,
Here is a textbox event that only allows numeric input Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) Select Case KeyAscii Case 48 To 57 'Nos 0 - 9 Exit Sub Case 32 ' space Case Else Application.EnableEvents = False KeyAscii = 0 Application.EnableEvents = True Beep End Select End Sub It also allows spaces, if you don't want that remove the line Case 32 ' space -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Beginner" wrote in message ... hi! i have a multipage within a form. the multipage has several textboxes. some of them use the values of the others textboxes to do math thing, like adds. everything goes wrong when the user capture characters. how can i ensure the user to capture only numbers, integer numbers? tia. |
All times are GMT +1. The time now is 05:47 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com