Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Textbox validation | Excel Discussion (Misc queries) | |||
textbox validation | Excel Programming | |||
textbox value validation | Excel Programming | |||
Textbox validation | Excel Programming | |||
textbox validation | Excel Programming |