从 VBA 中的多选列表框获取字符串的绑定按钮
binding buttom to get strings from multiselect listbox in VBA
如果用户单击 excel(VBA) 中的按钮,有人知道如何从多选列表框中获取字符串吗?
如果我点击按钮,它会将字符串放入特定的单元格中,如 D18、D19 等等..
这里是一个小概览。
http://fs1.directupload.net/images/150625/o8xhqsll.jpg
我认为最好的办法是看一下这段代码,然后尝试一下。如果您有更多问题,请回来。
Private Sub UserForm_Initialize()
Me.ComboBox1.AddItem "a"
Me.ComboBox1.AddItem "b"
Me.ComboBox1.AddItem "c"
Me.ComboBox1.AddItem "d"
End Sub
Private Sub CommandButton1_Click()
Dim intComboItem As Integer
For intComboItem = 0 To Me.ComboBox1.ListCount - 1
If Me.ComboBox1.List(intComboItem).Selected = True then
''''Do something
End If
Next
End Sub
如果用户单击 excel(VBA) 中的按钮,有人知道如何从多选列表框中获取字符串吗? 如果我点击按钮,它会将字符串放入特定的单元格中,如 D18、D19 等等..
这里是一个小概览。 http://fs1.directupload.net/images/150625/o8xhqsll.jpg
我认为最好的办法是看一下这段代码,然后尝试一下。如果您有更多问题,请回来。
Private Sub UserForm_Initialize()
Me.ComboBox1.AddItem "a"
Me.ComboBox1.AddItem "b"
Me.ComboBox1.AddItem "c"
Me.ComboBox1.AddItem "d"
End Sub
Private Sub CommandButton1_Click()
Dim intComboItem As Integer
For intComboItem = 0 To Me.ComboBox1.ListCount - 1
If Me.ComboBox1.List(intComboItem).Selected = True then
''''Do something
End If
Next
End Sub