Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / May 2008

Tip: Looking for answers? Try searching our database.

Validation for Textbox in Userform

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
shahzad4u_ksa@yahoo.com - 26 May 2008 16:09 GMT
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 - 26 May 2008 18:01 GMT
If textbox1.text Like "[A-Z][A-Z][A-Z] ##" then
   ' match
else
   ' try again
end if

Signature

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

> Dear Sir,
>
[quoted text clipped - 9 lines]
>
> Syed Shahzad Zafar
Rick Rothstein (MVP - VB) - 26 May 2008 18:03 GMT
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

> Dear Sir,
>
[quoted text clipped - 9 lines]
>
> Syed Shahzad Zafar
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.