Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a textbox on my main Userform that allows
someone type type in text. I would like to be able to test for cases when "nothing" is entered into the textbox, meaning no keystrokes were pressed inside the textbox. Additionally, I would like to know if the user pressed a sequence of blank or space characters. For example, if someone presses the spacebar a couple times, or the tab key, or a mixture of both, I would like some function to tell me that the text string contains a set of whitespace or blank characters. Or would it just be easier to test if the string contains ALL alphanumeric characters? Thanks! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Chekc out Len(Trim(userform.txtbxFName.text))
e.g., If Len(Trim(userform.txtbxFName.text))=0 then MsgBox "Nope, you have to enter something for the First name" End if On Dec 30, 10:42*am, "Robert Crandal" wrote: I have a textbox on my main Userform that allows someone type type in text. *I would like to be able to test for cases when "nothing" is entered into the textbox, meaning no keystrokes were pressed inside the textbox. *Additionally, I would like to know if the user pressed a sequence of blank or space characters. For example, if someone presses the spacebar a couple times, or the tab key, or a mixture of both, I would like some function to tell me that the text string contains a set of whitespace or blank characters. Or would it just be easier to test if the string contains ALL alphanumeric characters? Thanks! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Using Trim may remove the space(s) he wants to detect. I would just do
something like this: If txtWhatever.Value="" then No need to specify the userform name if the code is in the userform module. "AB" wrote in message ... Chekc out Len(Trim(userform.txtbxFName.text)) e.g., If Len(Trim(userform.txtbxFName.text))=0 then MsgBox "Nope, you have to enter something for the First name" End if |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I could be wrong, but perhaps Robert wants to validate text boxes -
that users enter something but blanks in there - hence trim actually helps. In the other post Rob had a code referencing the userform externally, hence used the form reference too. On Dec 30, 11:39*am, "Jim Rech" wrote: Using Trim may remove the space(s) he wants to detect. *I would just do something like this: *If txtWhatever.Value="" then No need to specify the userform name if the code is in the userform module. "AB" wrote in message ... Chekc out Len(Trim(userform.txtbxFName.text)) e.g., If Len(Trim(userform.txtbxFName.text))=0 then * MsgBox "Nope, you have to enter something for the First name" End if |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks.....that works for me.
"AB" wrote in message ... Chekc out Len(Trim(userform.txtbxFName.text)) e.g., If Len(Trim(userform.txtbxFName.text))=0 then MsgBox "Nope, you have to enter something for the First name" End if |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Mind-numbing simple data validation ... string from 1 to 64 chars | Excel Worksheet Functions | |||
macro to bold number of chars from end of a string | Excel Discussion (Misc queries) | |||
extracting a single char from a string of chars | Excel Programming | |||
remove blanks from a string of chars within a cell? | Excel Discussion (Misc queries) | |||
Counting chars in a string | Excel Programming |