Macro to section out data from master sheet

lyn5339

New Member
Joined
Apr 3, 2013
Messages
13
i am working on a code to copy data from a loarge amount of data on a master worksheet and copy every 18,000 rows and place it on a new worksheet and then retrieve the next 18,000 from the master sheet and place it on a new sheet. i had the code to create the worksheet but am having trouble actually getting it loop and grab the next 18,000 without overlapping and copying the same data. anything ideas? let me know if anyone wants more clarification on the project.
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
i created a macro that can only run through 18,000 rows at a time. i troubleshooted this before and think it is because the macro involves inserting rows, Excel can only insert so many rows in one take. as for code all i have is the generic code to add the a work sheet and name it. i can record a mcro to get the code to cut from one sheet to another but i do not know where to start as far as taking the 18,000 chunks and then returning for the next chunk.
 
Upvote 0
Really gonna need either your code so far, or a more detailed spec. Otherwise I'm just going to give vague guidance which will likely not result in a solution for you.
 
Upvote 0
As nuked says, you won't get a customised solution without providing a lot more detail.

Below is some generic code you may be able to use. It will create a new worksheet for each batch of 18,000 rows...

Code:
Sub Copy_18k()
Dim Last_Row As Long
Dim i As Long
Dim Limit As Long
Application.ScreenUpdating = False
Limit = 18000
With Sheets("Master Worksheet")
    Last_Row = .Range("A" & Rows.Count).End(xlUp).Row
    
    For i = 1 To WorksheetFunction.Ceiling(Last_Row / Limit, 1)
        Range(.Cells(((i - 1) * Limit) + 1, 1), .Cells((i + 1) * Limit, 10)).Copy
        Sheets.Add
        ActiveSheet.Paste
    
    Next i
    
End With
Application.ScreenUpdating = True
End Sub
 
Upvote 0
this is all i had so far which i got off micrsoft's support site, i have only started learning macros and VBA for a little over a week:
Sub AddSheets()

Set newSheet = Worksheets.Add
newSheet.Name = "Data Sheet" + sheets.count
 
Upvote 0

Forum statistics

Threads
1,214,375
Messages
6,119,166
Members
448,870
Latest member
max_pedreira

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top