Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Detecting spaces in UserForm textboxes


Hi all,

I'm writting error code to search for empty textboxes in a userform.

Basically I have 4 textboxes that are to be associated with each other
These textboxes represent data pulled off of a spreadsheet that is t
be edited. If there is data in any of the 4, then all 4 must have dat
in them as well. If all 4 are empty, then the record on the spreadshee
is deleted.

My problem is if the user uses the spacebar instead of the Del key t
remove data from the textboxes, then the cells aren't truely empty a
far as VBA is concerned.

How do you make VBA count spacebar values as null value entries?

i.e. make "" = " " = " " = " ", etc?

I'm currently using:

If Controls("Textbox" & N).value < "" and _
(Controls("Textbox" & O).value = "" or _
Controls("Textbox" & P).value = "" or _
Controls("Textbox" & Q).value = "") then

MsgBox "Error, partially completed treatment detected!"
Exit Sub
End if

Repeated for each of the different textboxes.


Thanks

--
Ouk
-----------------------------------------------------------------------
Ouka's Profile: http://www.excelforum.com/member.php...fo&userid=2398
View this thread: http://www.excelforum.com/showthread.php?threadid=39794

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Detecting spaces in UserForm textboxes


Ouka Wrote:
Hi all,

I'm writting error code to search for empty textboxes in a userform.

Basically I have 4 textboxes that are to be associated with each other
These textboxes represent data pulled off of a spreadsheet that is t
be edited. If there is data in any of the 4, then all 4 must have dat
in them as well. If all 4 are empty, then the record on the spreadshee
is deleted.

My problem is if the user uses the spacebar instead of the Del key t
remove data from the textboxes, then the cells aren't truely empty a
far as VBA is concerned.

How do you make VBA count spacebar values as null value entries?

i.e. make "" = " " = " " = " ", etc?

I'm currently using:

If Controls("Textbox" & N).value < "" and _
(Controls("Textbox" & O).value = "" or _
Controls("Textbox" & P).value = "" or _
Controls("Textbox" & Q).value = "") then

MsgBox "Error, partially completed treatment detected!"
Exit Sub
End if

Repeated for each of the different textboxes.


Thanks!


I'd suggest using LEN to return the length of the string in th
textbox. If it returns zero then your textbox is empt

--
ronthedo
-----------------------------------------------------------------------
ronthedog's Profile: http://www.excelforum.com/member.php...fo&userid=2650
View this thread: http://www.excelforum.com/showthread.php?threadid=39794

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
Detecting spaces in UserForm textboxes Ouka[_15_] Excel Programming 0 August 22nd 05 10:57 PM
UserForm TextBoxes Rob Excel Discussion (Misc queries) 2 August 6th 05 03:07 AM
Detecting if a userform is loaded Seth[_5_] Excel Programming 2 November 4th 03 02:59 AM
userform textboxes again Jo[_6_] Excel Programming 4 October 21st 03 07:25 PM
userform textboxes Jo[_6_] Excel Programming 4 October 21st 03 07:15 PM


All times are GMT +1. The time now is 12:11 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"