|
要学会变通,简单修改一下就可以了,
- Sub test()
- Dim arr, sht As Worksheet, i As Integer
- Application.DisplayAlerts = False
- Application.ScreenUpdating = False
- For i = 1 To Sheets.Count
- If i <= 10 Then
- arr = Sheets(i).UsedRange
- Workbooks.Add
- With ActiveWorkbook.ActiveSheet
- .Name = Sheets(i).Name
- .Range("a1").Resize(UBound(arr), UBound(arr, 2)) = arr
- ActiveWorkbook.SaveAs ThisWorkbook.Path & "" & Sheets(i).Name & ".xlsx"
- ActiveWorkbook.Close True
- End With
- End If
- Next
- Application.DisplayAlerts = True
- Application.ScreenUpdating = True
- End Sub
复制代码
|
|