Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default Textbox validation



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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Textbox validation

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


  #3   Report Post  
Posted to microsoft.public.excel.programming
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.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Textbox validation

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.


I understood that part... what I want to know is **when** do you want to
restrict the entry. Are you trying to stop the user from typing a bad entry
in while he/she is actually typing? Or do you have an OK button and when
pressed, you want to parse the user's entry to see if it conforms to your
pattern and, if not, send the focus back into the TextBox for the user to
correct the entry? Or did you have some other method in mind?

Rick

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default Textbox validation

On May 27, 11:08*am, "Rick Rothstein \(MVP - VB\)"
wrote:
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 thefirstthreecheractorsshould betextand
last twocheractorsare Numaric.


I understood that part... what I want to know is **when** do you want to
restrict the entry. Are you trying to stop the user from typing a bad entry
in while he/she is actually typing? Or do you have an OK button and when
pressed, you want to parse the user's entry to see if it conforms to your
pattern and, if not, send the focus back into the TextBox for the user to
correct the entry? Or did you have some other method in mind?

Rick


Hi,

Yes I am trying to stop the user from typing a bad entry
in while he/she is actually typing, as well as I want when I hit Ok
button then it will will show in the worksheet like this Format "ENG
77" .

pls help me it is important for me.

Regards

Shahzad



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Textbox validation

Yes I am trying to stop the user from typing a bad entry
in while he/she is actually typing, as well as I want when I
hit Ok button then it will will show in the worksheet like this
Format "ENG 77" .

pls help me it is important for me.


Okay, that request is doable, but not easily so. I am just about to go to
sleep for the night, so I won't be able to work on the code for you until
(my) tomorrow sometime. I'll work on it when I get up and post it later on
in the day. By the way, where in the worksheet will you want it placed?

Rick

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Textbox validation TUNGANA KURMA RAJU Excel Discussion (Misc queries) 5 May 8th 09 11:15 PM
textbox validation TC[_6_] Excel Programming 2 October 13th 04 03:19 AM
textbox value validation girapas[_2_] Excel Programming 1 July 19th 04 12:16 PM
Textbox validation phreud[_17_] Excel Programming 6 June 27th 04 07:49 PM
textbox validation Beginner[_2_] Excel Programming 1 April 7th 04 07:46 PM


All times are GMT +1. The time now is 07:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"