ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   test for field that just has spaces in it (https://www.excelbanter.com/excel-programming/339399-test-field-just-has-spaces.html)

Brad

test for field that just has spaces in it
 
Thanks for taking the time to read my question.

I have a form on which users enter info. The only required field is the
product code. I have it that if there is no value in the product code field,
they can't click the button to add the new info. Even if they add all data,
then delete the product code, the button becomes inactive. The only way they
can get around this.. and they have :( is to add a bunch of spaces.

How do I test for an indefinate amount of spaces?

Thanks,

Brad

Charlie

test for field that just has spaces in it
 
Use the Trim function, something like this:

If Trim(Text1) = "" Then
MsgBox "Input Required"
Text1.SetFocus
Exit Sub
End If


"Brad" wrote:

Thanks for taking the time to read my question.

I have a form on which users enter info. The only required field is the
product code. I have it that if there is no value in the product code field,
they can't click the button to add the new info. Even if they add all data,
then delete the product code, the button becomes inactive. The only way they
can get around this.. and they have :( is to add a bunch of spaces.

How do I test for an indefinate amount of spaces?

Thanks,

Brad


Brad

test for field that just has spaces in it
 
Thanks Charlie!

That is perfect!

Brad

"Charlie" wrote:

Use the Trim function, something like this:

If Trim(Text1) = "" Then
MsgBox "Input Required"
Text1.SetFocus
Exit Sub
End If


"Brad" wrote:

Thanks for taking the time to read my question.

I have a form on which users enter info. The only required field is the
product code. I have it that if there is no value in the product code field,
they can't click the button to add the new info. Even if they add all data,
then delete the product code, the button becomes inactive. The only way they
can get around this.. and they have :( is to add a bunch of spaces.

How do I test for an indefinate amount of spaces?

Thanks,

Brad



All times are GMT +1. The time now is 01:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com