ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Program a combobox/dropdownlist to create (https://www.excelbanter.com/excel-programming/281148-program-combobox-dropdownlist-create.html)

ed

Program a combobox/dropdownlist to create
 
Hi all,

I want to Program a combobox/dropdownlist to create
textboxes dynamically.

A user simply selects a number from a combobox, say from 1-
10 and this creates a corresponding number of label and
textboxes.

Thanks
Edward


..



Tom Ogilvy

Program a combobox/dropdownlist to create
 
Where are these located?

Where do you want them created?

ActiveX controls or Forms controls?

--
Regards,
Tom Ogilvy

ed wrote in message
...
Hi all,

I want to Program a combobox/dropdownlist to create
textboxes dynamically.

A user simply selects a number from a combobox, say from 1-
10 and this creates a corresponding number of label and
textboxes.

Thanks
Edward


.





No Name

Program a combobox/dropdownlist to create
 
Sorry, I left out pertinent information.

I want these controls created on a user form as form
controls.

Thanks
Ed


-----Original Message-----
Where are these located?

Where do you want them created?

ActiveX controls or Forms controls?

--
Regards,
Tom Ogilvy

ed wrote in message
...
Hi all,

I want to Program a combobox/dropdownlist to create
textboxes dynamically.

A user simply selects a number from a combobox, say

from 1-
10 and this creates a corresponding number of label and
textboxes.

Thanks
Edward


.




.


Dave Peterson[_3_]

Program a combobox/dropdownlist to create
 
Instead of adding them, you could just design them in and hide them. Then after
you get the value from the user, just unhide the ones you want.

Option Explicit
Private Sub ComboBox1_Change()
Dim iCtr As Long
For iCtr = 1 To 10
Me.Controls("textbox" & iCtr).Visible _
= CBool(iCtr <= CLng(Me.ComboBox1.Value))
Next iCtr
End Sub
Private Sub UserForm_Initialize()
Dim iCtr As Long
For iCtr = 1 To 10
Me.Controls("textbox" & iCtr).Visible = False
Me.ComboBox1.AddItem iCtr
Next iCtr
End Sub

I put 10 textboxes in the userform. They were named textbox1 thru textbox10--so
the code would work.


wrote:

Sorry, I left out pertinent information.

I want these controls created on a user form as form
controls.

Thanks
Ed

-----Original Message-----
Where are these located?

Where do you want them created?

ActiveX controls or Forms controls?

--
Regards,
Tom Ogilvy

ed wrote in message
...
Hi all,

I want to Program a combobox/dropdownlist to create
textboxes dynamically.

A user simply selects a number from a combobox, say

from 1-
10 and this creates a corresponding number of label and
textboxes.

Thanks
Edward


.




.


--

Dave Peterson



All times are GMT +1. The time now is 03:44 PM.

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