来源
http://tieba.baidu.com/p/3315986877mypath的赋值语句后面那截是文件的名称,自己改改。
在当前工作表下执行。
Sub copytowkb()
Dim i As Long
Dim rng As Range
Dim mypath As String
mypath = ThisWorkbook.Path & "\ASDFGHJKL滑动解锁什么这样也能重复_"
Application.ScreenUpdating = False
With ActiveSheet
For i = 1 To 10000
Set rng = .Range(i * 200 - 199 & ":" & i * 200)
If WorksheetFunction.CountA(rng) = 0 Then Exit For
If Dir(mypath & Format(i, "000") & ".xlsx") = "" Then
Workbooks.Add
rng.Copy ActiveSheet.Cells(1, 1)
ActiveWorkbook.SaveAs mypath & Format(i, "000") & ".xlsx"
ActiveWorkbook.Close
Else
MsgBox mypath & Format(i, "000") & ".xlsx" & Chr(13) & "文件名重复,不干了"
Exit For
End If
Next i
End With
Application.ScreenUpdating = True
End Sub