用 vba 中的数组填充列表框
Fill a listbox with an array in vba
有人知道如何从 array
中填充 listbox
吗?我只知道方法:
With Tabelle1.ListBox1
.AddItem "Versuch"
End With
我想做一个dynamic listbox
但还是不知道。
Sub Listbox_Things()
'My Listbox is called "Listbox1" and it is located on "Sheet1"
'With the Listbox visible, F8 through this code
With Sheet1.ListBox1
.List = Split("1,2,3", ",")
.Clear
.List = Array("One", "Two", "Three")
.Clear
.List = Array(1, 2, 3)
.Clear
Dim x() As Variant
x = Array("One", "Two", "Three")
.List = x
.Clear
.List = Application.GetCustomListContents(4)
End With
End Sub
有人知道如何从 array
中填充 listbox
吗?我只知道方法:
With Tabelle1.ListBox1
.AddItem "Versuch"
End With
我想做一个dynamic listbox
但还是不知道。
Sub Listbox_Things()
'My Listbox is called "Listbox1" and it is located on "Sheet1"
'With the Listbox visible, F8 through this code
With Sheet1.ListBox1
.List = Split("1,2,3", ",")
.Clear
.List = Array("One", "Two", "Three")
.Clear
.List = Array(1, 2, 3)
.Clear
Dim x() As Variant
x = Array("One", "Two", "Three")
.List = x
.Clear
.List = Application.GetCustomListContents(4)
End With
End Sub