ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error copying sheets (https://www.excelbanter.com/excel-programming/386525-error-copying-sheets.html)

Spike

Error copying sheets
 
I have a template in a workbook and the macro copies this to a new sheet,
renames the sheet and then carries on down a list of fund codes (copying the
template to a new sheet and renaming it), this works fine for the first 30 or
so then errors out. My code is below and i will be grateful if anyone can
point me in the right direction as to how to sort this problem out. It does
not always happen which is very frustrating.

For Each cell In Range(Range("ClientFunds").Offset(1, 0),
Range("ClientFunds").End(xlDown))

Application.ThisWorkbook.Sheets("Template").Select
Application.ThisWorkbook.Sheets("Template").Copy
after:=Sheets("Template") 'copies temtplate sheet

Sheets("Template" & " (2)").Name = cell '.Value 'renames
template sheet to fund in question
Next


--
with kind regards

Spike


All times are GMT +1. The time now is 01:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com