Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
populate combo box
I need to populate a combo box on a userform. I need the combobox to have
two columns and for the columns to take their information from a worksheet. The problem is that the two columns of information are not beside each other so I cant get it to work. Can anyone hep? |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
populate combo box
Maybe something like this will help:
Option Explicit Private Sub CommandButton1_Click() Unload Me End Sub Private Sub CommandButton2_Click() With Me.ComboBox1 If .ListIndex -1 Then MsgBox .List(.ListIndex, 0) & vbLf & .List(.ListIndex, 1) End If End With End Sub Private Sub UserForm_Initialize() Dim myRng As Range Dim myCell As Range With Worksheets("sheet1") Set myRng = .Range("a1", .Cells(.Rows.Count, "A").End(xlUp)) End With With Me.ComboBox1 .ColumnCount = 2 For Each myCell In myRng.Cells .AddItem myCell.Value .List(.ListCount - 1, 1) = myCell.Offset(0, 2).Value Next myCell End With End Sub enyaw wrote: I need to populate a combo box on a userform. I need the combobox to have two columns and for the columns to take their information from a worksheet. The problem is that the two columns of information are not beside each other so I cant get it to work. Can anyone hep? -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Populate a combo box | Excel Discussion (Misc queries) | |||
Best way to populate worksheet from 2 combo boxes | Excel Worksheet Functions | |||
Populate a combo Box | Excel Worksheet Functions | |||
Populate embedded combo box | Excel Worksheet Functions | |||
Populate embedded combo box | Excel Worksheet Functions |