|
参与一下。。。- Sub ykcbf() '//2024.1.27
- Set Fso = CreateObject("scripting.filesystemobject")
- Application.ScreenUpdating = False
- Set sh = ThisWorkbook.Sheets("工资汇总")
- p = ThisWorkbook.Path & ""
- ReDim brr(1 To 10000, 1 To 30)
- On Error Resume Next
- For Each f In Fso.GetFolder(p).Files
- If f.Name Like "*.xls*" Then
- If InStr(f.Name, ThisWorkbook.Name) = 0 Then
- fn = Fso.GetBaseName(f)
- Set wb = Workbooks.Open(f, 0)
- With wb.Sheets("录入")
- arr = .UsedRange
- wb.Close False
- End With
- For i = 5 To UBound(arr)
- If arr(i, 2) <> Empty Then
- m = m + 1
- brr(m, 1) = m
- For j = 2 To UBound(arr, 2)
- brr(m, j) = arr(i, j)
- Next
- End If
- Next
- End If
- End If
- Next f
- With sh
- .UsedRange.Offset(2) = ""
- .[a3].Resize(m, 26) = brr
- End With
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|