|
Private Sub CommandButton1_Click()
Dim x, j, i As Integer
arrzcm = Split(Sheet1.Range("A2"), Chr(10)) '子项目
i = 0
ListBox1.Clear
For i = 0 To UBound(arrzcm)
If arrzcm(i) <> "" Then
ListBox1.AddItem
ListBox1.List(j) = arrzcm(i)
j = j + 1
End If
Next i
Set arrzcm = Nothing
ListBox2.Clear
j = 0
For x = 2 To 6
Set arrdd = Nothing
arrdd = Split(Sheet1.Cells(2, x), Chr(10)) '↓导入订单
If UBound(arrdd) > 0 Then
ListBox2.AddItem arrdd(0), j
For y = 1 To UBound(arrdd)
ListBox2.List(j, y) = arrdd(y) '对应sheet2 x列导入到listbox的x-6列
Next y
j = j + 1
End If
Next x
MsgBox "listbox2有" & ListBox2.ListCount & "行"
End Sub
|
|