Repeat Macro Several Times

dcwinter

Board Regular
Joined
Aug 10, 2007
Messages
118
Hello,

I need a macro to do the following:

Take a customer name from a list of customers and add it to a cell (B2) in a worksheet ("Data Sheet - Product List").

Once this has been done, a sheet form the workbook is then copied into a new workbook ("Dashboard Monthly Reports").

I then need to do the same for the next customer to the bottom of the list, adding each copy of the worksheet to the "Dashboard Monthly reports" workbook.

The main part I'm struggling with is working out how to get it run down the list...

Any help greatly appreciated.

Danny
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

njimack

Well-known Member
Joined
Jun 17, 2005
Messages
7,772
Assuming your list of customers starts in A2 of sheet 1...

Code:
Sub Test()
Dim End_Row As Long, n as Long

End_Row = Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row

For n = 2 to End_Row

Sheets("Data Sheet - Product List").Range("B2") = Sheets("Sheet1").Cells(n,1)
'rest of your code goes here...

Next n

End Sub
 
Upvote 0

Forum statistics

Threads
1,190,691
Messages
5,982,314
Members
439,772
Latest member
KimPhoenixT

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
Top