VBA comboBoxes如何使用索引获取值

时间:2018-11-06 12:18:25

标签: excel vba excel-vba

我在用户窗体中有组合框,我想首先将组合框的值放入数组中,我需要使用组合框中的值的索引来填充数组,但要使用.listIndex = number给我错误这里是我的代码任何赞赏

Private Sub countItemsOnThecombo()
Dim itemOnCombo As Long
Dim itemd As Integer
Dim Comboarr() As String

itemOnCombo = Me.ComboBox1.ListCount
MsgBox "1The list count" & itemOnCombo
MsgBox "2with the index" & UserForm1.ComboBox1.ListIndex = 0
'ReDim Comboarr(itemOnCombo)
'For itemd = 1 To UBound(Comboarr)
'Comboarr(itemd) = Me.ComboBox1.ListIndex = itemd
'MsgBox Comboarr(itemd) 'Me.ComboBox1.ListIndex = itemd 'Comboarr(itemd)
'Next itemd


End Sub

0 个答案:

没有答案