ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   putting validation to TextBox in the userform (https://www.excelbanter.com/excel-programming/292571-putting-validation-textbox-userform.html)

salihyil[_6_]

putting validation to TextBox in the userform
 
hello guys

i use userform to autofilter the data from the list. when i put th
username it just filters the usernames details.

Question:
does anyone know how to put validation to textbox. eg just letters. i
end-user puts number, i want system to show an error message.

and also if the text that will be put in textbox does not exist i
(data,list)i want system to show error messege.

if you can help i will appriciate guys

thank

--
Message posted from http://www.ExcelForum.com


grinning_crow[_4_]

putting validation to TextBox in the userform
 
I think this is along the right lines...

Private Sub textbox1_KeyPress(ByVal KeyAscii As _

MSForms.ReturnInteger)

If Not IsNumeric(Chr(KeyAscii)) Then
msgbox "Please only use numbers"
KeyAscii = 0
End If

End Sub

Hope it is of some use

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 08:00 AM.

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