First Macro - would like it to loop through all batches.

BigDxwg

New Member
Joined
Oct 27, 2017
Messages
6
Hi all,
I have proudly created my first macro (albeit using the Record feature in Excel).

I have a master data with about 100,000 rows of data and about 50 columns.

The master data sheet contains account information and related owners. The objective is to split this data by batches and send out these details out. However there are around 4,000 batches, each batch can have 1 or more account. On the master I am giving them a batch no 100, 101, 102 etc.

I manually filter by batch and copy/paste relevant columns into new template, and repeat until we have created files for each of the batches. I created a macro and successfully copies/pastes into new template file and saves. However I now wish to add something to allow the batch to autoloop until all batches 1-4000 have been created and saved until there are no more matches. A simple google search has shown the code is not too long but there are so many different examples I am confused as to what would be best to use. The batch no is in Col A.

Can someone assist me with a sample code that would repeat until there are no more batches left. If my understanding is correct I would just need to add this to beginning of my existing code. Thanks in advance, any questions please ask.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,223,911
Messages
6,175,334
Members
452,636
Latest member
laura12345

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