Results 1 to 6 of 6

Suggested End Sub/End With Error- look at last posting

Threaded View

  1. #1
    Registered User
    Join Date
    07-13-2010
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2003
    Posts
    3

    Suggested End Sub/End With Error- look at last posting

    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
    Last edited by financeintern; 07-15-2010 at 10:14 AM. Reason: Corrected closing code tag

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1