My goal is to have a combo box appear when an Excel spreadsheet is opened, and to have the user select from the list. Each selection would run a different macro. This is what I have thus far.
Private Sub Workbook_Open()
Load frmTestDialog
frmTestDialog.Show
End Sub
Dim msg As String, i As Integer
msg = ""
With frmTestDialog.ComboBox1
ComboBox1.ColumnCount = 12
'# of dropdown rows in Combobox
ComboBox1.RowSource = "a1001: a1013"
'Fill ComboBox with range data
ComboBox1.ControlSource = "a1000"
'place the Combobox in cell a1000
For i = 0 To .ComboBox1 - 1
If .Selected(i) Then
msg = msg & .List(i) & Chr(13)
End If
Next i
End With
MsgBox msg, , "Selected items in Combobox1"
End Sub
The form loads, but the combobox syntax is not working. Does anyone have some sample code along these lines? It would be much appreciated.
Basically, I am looking to present different data entry variables to the user depending on their combobox selection.
Private Sub Workbook_Open()
Load frmTestDialog
frmTestDialog.Show
End Sub
Dim msg As String, i As Integer
msg = ""
With frmTestDialog.ComboBox1
ComboBox1.ColumnCount = 12
'# of dropdown rows in Combobox
ComboBox1.RowSource = "a1001: a1013"
'Fill ComboBox with range data
ComboBox1.ControlSource = "a1000"
'place the Combobox in cell a1000
For i = 0 To .ComboBox1 - 1
If .Selected(i) Then
msg = msg & .List(i) & Chr(13)
End If
Next i
End With
MsgBox msg, , "Selected items in Combobox1"
End Sub
The form loads, but the combobox syntax is not working. Does anyone have some sample code along these lines? It would be much appreciated.
Basically, I am looking to present different data entry variables to the user depending on their combobox selection.