识别用户窗体组合框中选定元素的索引
Identifying the Index of a Selected Element in Userform Combobox
我希望我能在用户窗体组合框列表中获得 selected 值的索引。
我试过下面的方法,但它显示的是值本身,而不是索引位置
MsgBox (Userform.Combobox.List(Userform.Combobox.ListIndex))
在下面的例子中:
0 - A
1 - B
2 - C
如果我 select 用户窗体组合框中的值 "B",我想打印索引 1
I've tried the below, but it shows me the value itself, instead of the index position
MsgBox (Userform.Combobox.List(Userform.Combobox.ListIndex))
UserForm.ComboBox.ListIndex
给你索引。
UserForm.ComboBox.List(index)
为您提供该索引处的值。
如果您只想要索引,请不要获取该索引处的值:
MsgBox Userform.Combobox.ListIndex
我希望我能在用户窗体组合框列表中获得 selected 值的索引。
我试过下面的方法,但它显示的是值本身,而不是索引位置
MsgBox (Userform.Combobox.List(Userform.Combobox.ListIndex))
在下面的例子中:
0 - A
1 - B
2 - C
如果我 select 用户窗体组合框中的值 "B",我想打印索引 1
I've tried the below, but it shows me the value itself, instead of the index position
MsgBox (Userform.Combobox.List(Userform.Combobox.ListIndex))
UserForm.ComboBox.ListIndex
给你索引。
UserForm.ComboBox.List(index)
为您提供该索引处的值。
如果您只想要索引,请不要获取该索引处的值:
MsgBox Userform.Combobox.ListIndex