HI,
hope this help. It is not set up just for 1MIO rows but always split in two files (half and half)
cheers,
Tomas
Sub split()
Dim count_row As Double
Dim count_col As Integer
Dim rng_c As Range
Dim rng_r As Range
Dim split_row As Double
Dim rest_row As Double
Dim thisfile As String
Dim newfile_1 As String
Dim newfile_2 As String
Application.ScreenUpdating = False
thisfile = ActiveWorkbook.Name
Set rng_c = ActiveSheet.Rows(1)
Set rng_r = ActiveSheet.Columns(1)
count_row = Application.WorksheetFunction.CountA(rng_r)
count_col = Application.WorksheetFunction.CountA(rng_c)
split_row = Round(((count_row - 1) / 2), 0)
rest_row = count_row - 1 - split_row
Range("A1:" & Cells(split_row + 1, count_col).Address(rowabsolute:=False, columnabsolute:=False)).Select
Selection.Copy
Workbooks.Add
newfile_1 = ActiveWorkbook.Name
ActiveSheet.Paste
Application.CutCopyMode = False
Workbooks(thisfile).Activate
Range("A1:" & Cells(1, count_col).Address(rowabsolute:=False, columnabsolute:=False)).Select
Selection.Copy
Workbooks.Add
newfile_2 = ActiveWorkbook.Name
ActiveSheet.Paste
Workbooks(thisfile).Activate
Range("A" & split_row + 2 & ":" & Cells(split_row + rest_row + 2, count_col).Address(rowabsolute:=False, columnabsolute:=False)).Select
Selection.Copy
Workbooks(newfile_2).Activate
Range("A2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
Bookmarks