绑定buttom从VBA中的多选列表框中获取字符串

时间:2015-06-25 16:38:33

标签: excel vba excel-vba listbox

如果用户点击excel(VBA)中的按钮,有人知道如何从多选列表框中获取字符串吗? 如果我点击按钮,它会将字符串带入特定的单元格,如D18,D19等等。

这里有一点概述。 http://fs1.directupload.net/images/150625/o8xhqsll.jpg

1 个答案:

答案 0 :(得分:0)

I think the best bet is to take a look at this code, and try it out. Come back if you have more questions. 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