Repeated worksheet copy error

Joined
Sep 26, 2011
Messages
2
I have a macro which allows a user to paste a list of equipment ID names into a range. The macro will then make a copy of a template worksheet for each equipment ID and add it to the workbook. I find that when I run this for more than 20 or so equipment IDs the macro will fail without an error. Even when I stop the macro I cannot manually copy worksheets. It seems to be a memory issue. If I save and close the sheet and re-open I can copy and paste manually again.

The particular section of code where the macro hangs is the third line of the for loop below.

Code:
For Each c In Selection.Cells
tName = c.Value
    Sheets("Template").Select
    Sheets("Template").Copy Before:=Sheets("Definition")
    ActiveSheet.Name = tName
 
...more operations...
 
Next c

Does anyone have any suggestions as to how to prevent this happening or more details on what is going on?

Many thanks in advance.
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Thanks for the welcome and the assistance.

I don't know how many different searches I put into Google but I never managed to pull up that entry. Thanks very much!
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

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