+ Reply to Thread
Results 1 to 6 of 6

Run Time error when macro references copy range on a separate worksheet

  1. #1
    Registered User
    Join Date
    01-31-2013
    Location
    Burlington, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    21

    Run Time error when macro references copy range on a separate worksheet

    Hopefully, this is a simple problem with the code on Sheet1 that is run on deactivation. I have moved the range that is being copied (Copy_Range) to a new sheet (Copy) so that it won't be deleted accidentally.

    Now when you move off Sheet1, the macro runs and "Run-time error ‘1004’:
    Method ‘Range of Object’_Worksheet’failed" is returned. IF I click "OK", the pivottable is still properly populated, however I don't want the run-time error.

    Hopefully this is simply a syntax error in the sheet1 code:

    Please Login or Register  to view this content.
    Thanks.

    Craig
    Attached Files Attached Files

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: Run Time error when macro references copy range on a separate worksheet

    Try qualifying the ranges with their sheet references.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    01-31-2013
    Location
    Burlington, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: Run Time error when macro references copy range on a separate worksheet

    Thanks very much, TMS. I tried to qualify the worksheets, but I am not very experienced in code writing, so the problem is likely with the syntax. I tried the code below, but something isn't working. Please let me know if you see an obvious error.

    Thanks again.

    CDEG

    Please Login or Register  to view this content.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: Run Time error when macro references copy range on a separate worksheet

    Please Login or Register  to view this content.

    Regards, TMS

  5. #5
    Registered User
    Join Date
    01-31-2013
    Location
    Burlington, Ontario
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: Run Time error when macro references copy range on a separate worksheet

    Thanks again. This worked and that is all I needed. Many thanks.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,445

    Re: Run Time error when macro references copy range on a separate worksheet

    You're welcome.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Macro to copy 3 adjacent columns at a time to a separate worksheet & sort by Company name
    By anya1 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-20-2013, 06:50 AM
  2. Run Time Error '6' Overflow - Macro That Find Text and Copy Range & Replace on Other Sheet
    By asgharhussaini in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-17-2013, 04:34 AM
  3. [SOLVED] macro error Copy Time format to other Worksheet and continues copy range
    By feroguz in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-25-2012, 01:30 PM
  4. Macro To Copy Specific Data Into A Separate Worksheet
    By sgp in forum Excel Programming / VBA / Macros
    Replies: 43
    Last Post: 01-31-2012, 12:14 PM
  5. Copy range to worksheet - 1004 Run Time error
    By inky in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-10-2008, 07:39 AM

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