Test for string of space chars?

R

Robert Crandal

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!
 
A

AB

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
 
A

AB

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.
 
R

Robert Crandal

Thanks.....that works for me.

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top