【发布时间】:2016-09-27 21:31:38
【问题描述】:
我是 VBA 新手,我想知道将 ListBox 中第二列的值与用户填写的 TextBox 连接起来的最佳方法是什么?
到目前为止我的代码:
Private Sub UserForm_Initialize()
With ListBox1
.ColumnCount = 2
.ColumnHeads = False
.ColumnWidths = "30;15"
.MultiSelect = 0
ListBox1.AddItem "AAA"
ListBox1.AddItem "BBB"
ListBox1.AddItem "CCC"
ListBox1.AddItem "DDD"
ListBox1.List(0, 1) = 15
ListBox1.List(1, 1) = 19
ListBox1.List(2, 1) = 49
ListBox1.List(3, 1) = 45
End With
End Sub
现在我有 TextBox aka DWG,用户在其中输入大约 5 个数字左右。
Private Sub DWG_change
Dwg= "Numbers" & ListBox."SecondColumnValue"
End Sub
【问题讨论】:
标签: excel textbox listbox concatenation vba