|
参与一下。。。
- Sub ykcbf() '//2024.4.17
- Application.ScreenUpdating = False
- p = ThisWorkbook.Path
- Set sh = ThisWorkbook.Sheets("汇总")
- f = p & "\分表\明细.xls"
- Set wb = Workbooks.Open(f, 0)
- With wb.Sheets("明细")
- r = .Cells(Rows.Count, 2).End(3).Row
- If r > 5 Then arr = .[b6].Resize(r - 5, 2)
- wb.Close False
- End With
- With sh
- .UsedRange.Offset(1) = ""
- .[a1].Resize(1, 2).Interior.Color = 49407
- .[a2].Resize(UBound(arr), UBound(arr, 2)) = arr
- If r > 5 Then
- MsgBox "数据已录入 !"
- Else
- MsgBox "文件夹中没有数据 !" & VBA.Chr(10) & VBA.Chr(10) & "请重新下载数据 !"
- End If
- End With
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|