Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
For Each array - TextBoxes in a UserForm
TextBoxe2 through TextBox21 might or might not be filled in by the
user. If any one is, then I want to go to a sub named EnterRecords. I thought a For Each loop could work to test each TextBox for entry. I know this is not correct syntax, but this is what I'm trying to do.... For Each (TextBox2 through Textbox21) If TextBox*.Text = " " Then EnterRecords End If Next Am I close? Can it be this simple? Thanks, J.O. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
For Each array - TextBoxes in a UserForm
Thanks, Martin.
This worked fine. For future reference to anyone reading this, looking for similar help, I had to change it slightly. Because I had the code in a Standard Module, I had to change the 1st line to: if UserForm3.controls("TextBox" & i) < "" Then When I ran it the way it was written below, it gave me an error, but Help was pretty clear on what I needed to do. Thanks again for your help, and to others who contributed, too. J.O. Martin Fishlock wrote: Hi: Try this, you were quite close: dim i as integer For i=2 to 21 if me.controls("TextBox" & i) < "" Then EnterRecords End If Next i -- Hope this helps Martin Fishlock Please do not forget to rate this reply. "excelnut1954" wrote: TextBoxe2 through TextBox21 might or might not be filled in by the user. If any one is, then I want to go to a sub named EnterRecords. I thought a For Each loop could work to test each TextBox for entry. I know this is not correct syntax, but this is what I'm trying to do.... For Each (TextBox2 through Textbox21) If TextBox*.Text = " " Then EnterRecords End If Next Am I close? Can it be this simple? Thanks, J.O. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
UserForm TextBoxes | Excel Discussion (Misc queries) | |||
selection all textboxes in userform at once | Excel Programming | |||
userform & textboxes | Excel Programming | |||
userform textboxes again | Excel Programming | |||
userform textboxes | Excel Programming |