Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
i have two combo boxes: cboCount1 and cboCount2.
i have a long list of same items added to the drop down list of both combo boxes. With cboCount1 .additem = "1" .additem = "2" .additem = "3" End With With cboCount2 .additem = "1" .additem = "2" .additem = "3" End With I need to make my codes as short and compressed as possible. I want to use the same list for both combo boxes but use a shortcut. How can i achieve this. thanks in advance |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe you can just do one item by item and use that list for the second
combobox. Option Explicit Private Sub UserForm_Initialize() With Me.cboCount1 .AddItem "1" .AddItem "2" .AddItem "3" End With Me.cboCount2.List = Me.cboCount1.List End Sub Or just build one array and use it twice: Option Explicit Private Sub UserForm_Initialize() Dim myArr As Variant myArr = Array("1", "2", "3") Me.cboCount1.List = myArr Me.cboCount2.List = myArr End Sub ernie wrote: i have two combo boxes: cboCount1 and cboCount2. i have a long list of same items added to the drop down list of both combo boxes. With cboCount1 .additem = "1" .additem = "2" .additem = "3" End With With cboCount2 .additem = "1" .additem = "2" .additem = "3" End With I need to make my codes as short and compressed as possible. I want to use the same list for both combo boxes but use a shortcut. How can i achieve this. thanks in advance -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
dropdownmenu with additem | Excel Programming | |||
combobox additem | Excel Programming | |||
additem performance | Excel Programming | |||
AddItem Method | Excel Programming | |||
.additem | Excel Programming |