1

我正在用值填充列表框,并且只是希望它们显示编号。我从一张纸上得到我的范围,只想偷偷溜进一个循环计数器,然后加载范围。原始数据表上不存在编号,所以我选择了这条路线。这是原始代码:

 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 个值....

谢谢你的帮助。

4

1 回答 1

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

ETC...

于 2012-11-27T01:19:14.907 回答