|
- Private Sub CommandButton1_Click()
- Dim arr(1 To 8, 1 To 8)
- Dim i As Long, j As Long
- Dim lRecord As Long
- With Me.ListView1
- 'ReDim arr(1 To 8, 1 To 8)
- For i = 1 To .ListItems.Count
- With .ListItems(i)
- If Val(.SubItems(8)) > 0 And Val(.SubItems(8)) <= 8 Then
- lRecord = Val(.SubItems(8))
- arr(lRecord, 1) = .Text
- For j = 4 To 11
- arr(lRecord, j - 3) = .SubItems(j)
- Next
- End If
- End With
- Next
- End With
- With Sheet2
- .Range("p66").Resize(UBound(arr), UBound(arr, 2)).Value = arr
- End With
- MsgBox "写入完成"
- End Sub
复制代码 |
|