我正在使用值填充列表框,只是希望它们显示为编号。我从一张纸上得到我的范围,只想潜入一个循环计数器,然后加载范围。原始数据表中不存在编号,因此我选择此路线。这是原始代码:
Dim myArray As Variant
numbldsec = Worksheets("bld").Cells(2, 1).Value
myArray = Worksheets("bld").Range("A3:A" & numbldsec + 2)
With Worksheets("plots")
.ListBox1.List = myArray
.ListBox1.IntegralHeight = False
.ListBox1.IntegralHeight = True
.ListBox1.Height = 45
.ListBox1.Width = 69
.ListBox1.Top = 0
.ListBox1.Left = 1255.5
End With
所以我希望myArray每行有2个值....
感谢您的帮助。
答案 0 :(得分:1)
啊,这很有效:
Dim myArray As Variant
numbldsec = Worksheets("bld").Cells(2, 1).Value
myArray = Worksheets("bld").Range("A3:A" & numbldsec + 2).Value
For i = 1 To numbldsec ' pre-append radii with section numbers
myArray(i, 1) = i & " " & myArray(i, 1)
Next i
等...