J
James Stephens
I am looking for some advise on working around the excel row limit. I have the below formula that takes all workbooks in one folder, combines them into one new file and saves it into another folder. The issue is sometimes the amount of data will exceed the 65,536 row limitation. What I am looking for is a way to modify this so that if that limit is reached, a new sheet gets created and the data continues to be pasted into that sheet. This might need to go as high as four or five sheets. After that I have code that modifies this data considerably, but I think I can just use the code I have and modify it to do what it does to each sheet in the workbook instead of a specific worksheet
I have searched around on google and haven't really found a way to modify this code. Any help would be great. I just need to find a way for this to simply create a new page when the limit is reached and continue copying and pasting data
Thanks for any assistance you can give me with this, below is a copy of the code as it stands now
Ji
Sub CombineWorkbooks(
Dim LastRow As Lon
Dim basebook As Workboo
Dim i As Lon
Dim mybook As Workboo
With Applicatio
.DisplayAlerts = Fals
.EnableEvents = Fals
.ScreenUpdating = Fals
End Wit
With Application.FileSearc
.NewSearc
'Change this to your director
.LookIn = ThisWorkbook.Path & "\ProgramData\
.SearchSubFolders = Fals
.FileType = msoFileTypeExcelWorkbook
If .Execute() > 0 The
Set basebook = Workbooks.Open(.FoundFiles(1)
For i = 2 To .FoundFiles.Coun
Set mybook = Workbooks.Open(.FoundFiles(i)
With ActiveShee
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Ro
.Range("a1").Resize(LastRow, 18).Copy
basebook.Worksheets(1).Range("a1").End(xlDown).Offset(1, 0
End Wit
mybook.Clos
Next
ChDir ThisWorkbook.Path & "\ProgramData\FileData\Report\
ActiveWorkbook.SaveAs FileName:="Report1.xls", FileFormat
:=xlText, CreateBackup:=Fals
ActiveWorkbook.Clos
End I
End Wit
With Applicatio
.DisplayAlerts = Tru
.EnableEvents = Tru
End Wit
End Sub
I have searched around on google and haven't really found a way to modify this code. Any help would be great. I just need to find a way for this to simply create a new page when the limit is reached and continue copying and pasting data
Thanks for any assistance you can give me with this, below is a copy of the code as it stands now
Ji
Sub CombineWorkbooks(
Dim LastRow As Lon
Dim basebook As Workboo
Dim i As Lon
Dim mybook As Workboo
With Applicatio
.DisplayAlerts = Fals
.EnableEvents = Fals
.ScreenUpdating = Fals
End Wit
With Application.FileSearc
.NewSearc
'Change this to your director
.LookIn = ThisWorkbook.Path & "\ProgramData\
.SearchSubFolders = Fals
.FileType = msoFileTypeExcelWorkbook
If .Execute() > 0 The
Set basebook = Workbooks.Open(.FoundFiles(1)
For i = 2 To .FoundFiles.Coun
Set mybook = Workbooks.Open(.FoundFiles(i)
With ActiveShee
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Ro
.Range("a1").Resize(LastRow, 18).Copy
basebook.Worksheets(1).Range("a1").End(xlDown).Offset(1, 0
End Wit
mybook.Clos
Next
ChDir ThisWorkbook.Path & "\ProgramData\FileData\Report\
ActiveWorkbook.SaveAs FileName:="Report1.xls", FileFormat
:=xlText, CreateBackup:=Fals
ActiveWorkbook.Clos
End I
End Wit
With Applicatio
.DisplayAlerts = Tru
.EnableEvents = Tru
End Wit
End Sub