Textbox control
Brad, Try this:
Dim TB as MSForms.TextBox
Dim cnt as Long
For cnt = 0 to 9
Set TB = UserForm1.Controls("TextBox" & cnt + 1)
TB.Visible = True 'Add logic here
Next
P.S. This is untested but should get you very close. Let me know if you need
help.
--
Charles Chickering
"A good example is twice the value of good advice."
"Brad" wrote:
Very close.
The textboxes are already there, but based on the # entered, it will
determine how many of those boxes will be visible. So the loop or 'next'
statement will force the textbox to be visible (textbox2.visible = true).
Thank you for help!
"Charles Chickering" wrote:
Brad, Are you looking to do something like this?
Dim cnt As Long
Dim tb As MSForms.TextBox
For cnt = 0 To 9
Set tb = UserForm1.Controls.Add("Forms.TextBox.1", "Textbox" & cnt +
1)
tb.Top = tb.Height * cnt + 5
Next
--
Charles Chickering
"A good example is twice the value of good advice."
"Brad" wrote:
Hello, I'm creating a quote template through userforms. I have one section to
where the user will have to enter a customer number and city/state for up to
10 listings. So the user will enter a number (1 through 10) and the
appropriate number of boxes will appear. So if they enter 8, the first 8
boxes will appear. If they change their selection to 5, then only the first 5
boxes will appear. Now I know I can program a bunch of if statements to
control the boxes but that would be a lot ifs, is there a more simple way of
doing this via a loop or something? Any help and guidance is appreciated.
Thanks.
|