|
工作表分批另存- Sub ykcbf2() '//2024.9.11 工作表另存
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- p = ThisWorkbook.Path & ""
- p1 = p & "下拨批次"
- f = p & "批量下拨.xlsm"
- Set sh = ThisWorkbook.Sheets("转换")
- num = Val(sh.[b2].Value)
- rq = Format(Date, "yyyy-m-d")
- Set wb = Workbooks.Open(f, 0)
- With wb.Sheets(1)
- r = .Cells(Rows.Count, 1).End(3).Row
- c = .Cells(1, "XFD").End(1).Column
- arr = .[a1].Resize(r, c)
- bt = .[a1].Resize(, c)
- End With
- wb.Close 0
- k = r \ num + 1
- rr = 1 '//标题行数
- For x = 1 To k
- r1 = (x - 1) * num + 1 + rr
- If x = k Then r2 = UBound(arr) Else r2 = num * x + rr
- ReDim zrr(1 To num + 1, 1 To c)
- n = 0
- For i = r1 To r2
- n = n + 1
- For j = 1 To UBound(arr, 2)
- zrr(n, j) = arr(i, j)
- Next
- Next
- Set wb = Workbooks.Add
- With wb.Sheets(1)
- .[a1].Resize(, c) = bt
- .[a2].Resize(n, c) = zrr
- End With
- wb.SaveAs p1 & rq & "批量下拨" & Format(x, "00")
- wb.Close
- Next
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|