|
- Sub vba入门jimin()
- '扣扣494585639
- Dim MyPath$, MyName$, sh As Worksheet
- Dim brr(1 To 60000, 1 To 6)
- Application.ScreenUpdating = False
- Set sh = ActiveSheet
- Cells.Clear
- MyPath = ThisWorkbook.Path & ""
- MyName = Dir(MyPath & "*.xls*")
- Do While MyName <> ""
- If MyName <> ThisWorkbook.Name Then
- With GetObject(MyPath & MyName)
- m = m + 1
- If m = 1 Then
- arr = .Sheets("sheet1").Range("a1:f" & .Sheets("sheet1").Range("b65535").End(xlUp).Row)
- For i = 1 To UBound(arr)
- k = k + 1
- For j = 1 To UBound(arr, 2)
- brr(k, j) = arr(i, j)
- Next
- Next
- Else
- arr = .Sheets("sheet1").Range("a1:f" & .Sheets("sheet1").Range("b65535").End(xlUp).Row)
- For i = 2 To UBound(arr)
- k = k + 1
- For j = 1 To UBound(arr, 2)
- brr(k, j) = arr(i, j)
- Next
- Next
- End If
- .Close False
- End With
- End If
- MyName = Dir
- Loop
- Sheet1.Range("a1:f60000").ClearContents
- Sheet1.Range("a1").Resize(UBound(brr), UBound(brr, 2)) = brr
- Application.ScreenUpdating = True
- End Sub
复制代码 |
|