ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Validation for Textbox in Userform (https://www.excelbanter.com/excel-programming/411516-validation-textbox-userform.html)

[email protected]

Validation for Textbox in Userform
 

Dear Sir,

I prepared one Userform, I want to validate the text field like this.

SEP<SPACE 08 i.e. SEP 08 in capital letters.

what is the code for this purpose.

Waiting for your response..

Best Regards.

Syed Shahzad Zafar

Tim Zych

Validation for Textbox in Userform
 
If textbox1.text Like "[A-Z][A-Z][A-Z] ##" then
' match
else
' try again
end if

--
Tim Zych
www.higherdata.com
Compare data in workbooks and find differences with Workbook Compare
A free, powerful, flexible Excel utility


wrote in message
...

Dear Sir,

I prepared one Userform, I want to validate the text field like this.

SEP<SPACE 08 i.e. SEP 08 in capital letters.

what is the code for this purpose.

Waiting for your response..

Best Regards.

Syed Shahzad Zafar




Rick Rothstein \(MVP - VB\)[_1996_]

Validation for Textbox in Userform
 
I am pretty sure there is more to your question than you have posted, but to
answer the question you asked...

If TextBox1.Text = "SEP 08" Then
MsgBox "Valid entry"
End If

Just to take a guess at what your ultimate question may be, is the "SEP" an
abbreviation for a month? If so, and if you want to check that the input is
a 3-character for an actual month, consider this...

For X = 1 To 12
If TextBox1.Text = UCase(MonthName(X, True)) Then
MsgBox "Valid entry"
Exit For
End If
Next

Rick


wrote in message
...

Dear Sir,

I prepared one Userform, I want to validate the text field like this.

SEP<SPACE 08 i.e. SEP 08 in capital letters.

what is the code for this purpose.

Waiting for your response..

Best Regards.

Syed Shahzad Zafar




All times are GMT +1. The time now is 06:36 AM.

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