how to extract 20 000 lines out of 200 000 lines automatically
Oops, sorry. I sent the the wrong code. I didn't have 200,000 lines of data,
so I made up a miniature version. The code for the real thing is:
Sub DoWhatDDNeeds5()
A = 1
B = ThisWorkbook.Name
C = ActiveSheet.Name
D = "Split " & A & ".xls"
E = 2
F = 20000
Do Until Workbooks(B).Sheets(C).Cells(E, 1) = ""
D = "Split " & A & ".xls"
Workbooks.Add.SaveAs Filename:=D
Workbooks(B).Activate
Workbooks(B).Sheets(C). _
Range(Cells(E, 1), Cells(F, 8)) _
..Copy Workbooks(D).Sheets(1).Range("A2")
A = A + 1
E = F + 1
F = F + 20000
Loop
End Sub
|