Jimi Sherman
asked on
How to Split a list?
I need a Macro to split a long list into parts at every 350 rows with each part on a separate sheet.
I have attached two files so you can see an example.
Thanks,
Jimi
Routes-2013-9-24.xlsx
Routes-2013-9-24-Final.xlsx
I have attached two files so you can see an example.
Thanks,
Jimi
Routes-2013-9-24.xlsx
Routes-2013-9-24-Final.xlsx
ASKER
Hi,
When I run this only sheet2 has 350 rows the other sheets has over 700. I was looking for it to be like the "after" file I attached only 350 rows per sheet or less.
Thanks
When I run this only sheet2 has 350 rows the other sheets has over 700. I was looking for it to be like the "after" file I attached only 350 rows per sheet or less.
Thanks
Building on MartinLiss' code, try something like:
Option Explicit
Sub SplitData()
Dim lngLastRow As Long
Dim lngIndex As Long
lngLastRow = Range("A65536").End(xlUp).Row
For lngIndex = 2 To lngLastRow Step 350
Sheets("Sheet1").Range("A1:F1", "A" & lngIndex & ":F" & lngIndex + 349).Copy
Sheets.Add After:=Sheets(Sheets.Count)
Sheets(Sheets.Count).Paste
Debug.Print lngIndex & " " & lngIndex + 349
Sheets("Sheet1").Range("A2:F351").Delete
Next
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This works perfect!
Thanks
Thanks
You're welcome and I'm glad I was able to help. And I'm sorry I didn't notice that the first time.
Marty - MVP 2009 to 2013
Marty - MVP 2009 to 2013
Open in new window
BTW your original file would be much smaller if you deleted all or most of the blank rows in Sheet1.
Q-28248378.xlsm