I recently recorded a macro that involves copying sheets and pasting them range valued in another workbook. After 26 pasted tabs, the macro gets "tired" and displays a debug message. I then have to save the template and copied files, close out of both, open both back up, go into the macro and set the next statement to start with the 26th tab. The macro then finishes fine. This happens with all of my recorded macros that run the same way.
I was wondering if there was any way to write in code which could avoid this. I've tried a lot, but don't know a way to keep a macro running once the worksheet it is in is closed, which is necessary to refresh the macro.
The code below is repeated for every sheet, just the cell it pulls from in the template and the place in pastes the copied sheet is changed
Windows("x template.xls").Activate
Sheets("Names").Select
Range("B10").Select
Selection.Copy
Range("C2").Select
ActiveSheet.Paste
Sheets("BU").Select
Application.CutCopyMode = False
Sheets("BU").Copy After:=Workbooks("x Actuals.xls").Sheets( _
1)
Sheets("BU").Select
Sheets("BU").Name = "I-IA"
Cells.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("C12").Select
Any help is greatly appreciated and let me know if you need any more information from me!!
Thanks
Bookmarks