View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
[email protected] shahzad4u_ksa@yahoo.com is offline
external usenet poster
 
Posts: 68
Default Textbox validation

On May 27, 10:07*am, "Rick Rothstein \(MVP - VB\)"
wrote:
What exactly do you mean by "restrict textbox"? If you are talking about
"approving" an entry when the user tries to leave the TextBox, then you can
use something like this...

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
* If Not TextBox1.Text Like "[A-Za-z][A-Za-z][A-Za-z] ##" Then
* * Cancel = True
* * MsgBox "Your entry is not in the proper format!"
* * TextBox1.SelStart = 0
* * TextBox1.SelLength = Len(TextBox1.Text)
* End If
End Sub

If you have something else in mind when you say "restrict", you are going to
have to tell us what it is that you want to do.

Rick

wrote in message

...





Hi,


How to restrict textbox in userform for the following entry


SEP 08


I mean first three cheractors Alphabatic and space and two cheractors
number.


Regards.


Shahzad- Hide quoted text -


- Show quoted text -



Hi,

Actually I have a userform for the Data Entry, there is one field for
Part No.
my parts no starts like this

PLU 89
ELE 55
KIT 45
ENG 99

It means the first three cheractors should be text and last two
cheractors are Numaric.

hope it is clear to you.

Regards.