|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
报表统计.rar
(16.24 KB, 下载次数: 20)
Sub 数组法()
On Error Resume Next
Dim sh As Worksheet, MyPath$, MyName$, arr, m&
Set sh = ActiveSheet
'MyPath = ThisWorkbook.Path & "\"
MyPath = "D:" & "\9月分表\"
MyName = Dir(MyPath & "*.xls")
Application.ScreenUpdating = False
ActiveSheet.UsedRange.ClearContents
Do While MyName <> ""
If MyName <> ThisWorkbook.Name Then
m = m + 1
With GetObject(MyPath & MyName)
If m = 1 Then
arr = .Sheets("附件1").UsedRange
sh.[a1].Resize(UBound(arr), UBound(arr, 2)) = arr
Else
arr = .Sheets("附件1").UsedRange.Offset(1)
sh.[a65536].End(xlUp).Resize(UBound(arr), UBound(arr, 2)) = arr
End If
.Close False
End With
End If
MyName = Dir
Loop
[a65536].End(xlUp).EntireRow.Delete
For I = Sheets("附件1").Range("A56565").End(3).Row To 3 Step -1
If Sheets("附件1").Cells(I, 2) Like "" Then Sheets("附件1").Rows(I).Delete
If Sheets("附件1").Cells(I, 1) Like "*制表人签字*" Then Sheets("附件1").Rows(I).Delete
If Sheets("附件1").Cells(I, 1) Like "*序号*" Then Sheets("附件1").Rows(I).Delete
If Sheets("附件1").Cells(I, 2) = "" Then Sheets("附件1").Rows(I).Delete
Next
|
|