Excel VBA中是否有任何选项可以更改组合框的范围? See example
我想将Variant / Variant中的数字5更改为(0到3,0到5)。
组合框填充了以下代码:
Private Sub UserForm_Activate()
Dim x As Range
With Worksheets("Distributori")
Set x = .Range("A2", .Range("F1000").End(xlUp))
End With
ComboBox1.RowSource = "Distributori!" & x.Address
ComboBox1.ListIndex = 0
Me.ComboBox1.TextColumn = 2
结束子
答案 0 :(得分:0)
请尝试下一个(适应的)代码,
Dim x As Range, arrList As Variant
With Worksheets("Distributori")
Set x = .Range("A2", .Range("F1000").End(xlUp))
End With
arrList = x.Value
With ComboBox1
.ColumnCount = 6
.list = arrList
.ListIndex = 0
.TextColumn = 2
End With