Thread: .additem
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default .additem

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