【发布时间】:2019-01-14 10:06:33
【问题描述】:
大家早上好,
我编写了一个代码,通过按下按钮将列表框值放入 Excel 中的单元格中。
Private Sub CommandButton6_Click()
myVar = ""
For X = 0 To Me.transportation.ListCount - 1
If Me.transportation.Selected(X) Then
If myVar = "" Then
myVar = Me.transportation.List(X, 0)
Else
myVar = myVar & "," & Me.transportation.List(X, 0)
End If
End If
Next X
ThisWorkbook.Sheets("Visit 1").Range("d49") = myVar
Me.Hide
End Sub
我想将其更改为不使用按钮自动更新
【问题讨论】:
-
它是 ActiveX 列表框还是 FormControl 列表框?
-
对不起,我是新手,所以不确定,它是使用工具箱中的列表框选项创建的
-
是的,但是那里有 2 个不同的 ListBox:
ActiveX和FormControl。您需要知道它是哪一种,因为答案取决于控件的类型。
标签: excel vba listbox auto-update