|
4个表同时更新数据。
- Sub ykcbf() '//2024,3,26
- Application.ScreenUpdating = False
- bt = [{1,1,1,9}]
- fns = [{"Press","SAP-Coois","SAP-MB51","Press_月度实盘报告"}]
- p = ThisWorkbook.Path & ""
- Set ws = ThisWorkbook
- f = p & "导入文件.xlsx"
- Set wb = Workbooks.Open(f, 0)
- For x = 1 To UBound(fns)
- With ws.Sheets(fns(x))
- r = .Cells(Rows.Count, 1).End(3).Row
- c = .UsedRange.Columns.Count
- arr = .Cells(bt(x) + 1, 1).Resize(r - bt(x), c)
- End With
- With wb.Sheets(fns(x))
- .Cells(bt(x) + 1, 1).Resize(10000, c) = ""
- .Cells(bt(x) + 1, 1).Resize(UBound(arr), c).NumberFormatLocal = "@"
- .Cells(bt(x) + 1, 1).Resize(UBound(arr), c) = arr
- End With
- Next
- wb.Close 1
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|