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

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
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,215,675
Messages
6,126,153
Members
449,294
Latest member
Jitesh_Sharma

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