|
练习练习。。。
- Sub ykcbf() '//2024.12.8
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- p = ThisWorkbook.Path & ""
- rr = 500: bt = 1
- Set sh = ThisWorkbook.Sheets("Sheet1")
- With sh
- r = .Cells(Rows.Count, 1).End(3).Row
- c = .UsedRange.Columns.Count
- End With
- numSheets = Int((r - bt) / rr) + 1
- For i = 1 To numSheets
- k = k + 1
- r1 = bt + 1 + (i - 1) * rr
- r2 = Application.Min(bt + i * rr, r)
- sh.Copy
- Set wb = ActiveWorkbook
- With Sheets(1)
- .DrawingObjects.Delete
- .UsedRange.Offset(bt).Clear
- Set Rng = sh.Range(sh.Cells(r1, 1), sh.Cells(r2, c))
- Set destRange = .Cells(bt + 1, 1)
- Rng.Copy Destination:=destRange
- End With
- wb.SaveAs Filename:=p & k
- wb.Close
- Next
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|