+ Reply to Thread
Results 1 to 4 of 4

Copy Destination between two defined worksheets error

  1. #1
    Registered User
    Join Date
    11-06-2013
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    10

    Copy Destination between two defined worksheets error

    I have a code that works correctly up until a point in which a second copy destination code breaks up with an error and for the life of me I cannot figure out why.

    Hopefully, someone out there has an answer for me.

    The first copy destination works exactly as desired, however the second instance gives an error:
    Run-time error '1004':
    Application-defined or object-defined error

    Both workbooks have sheets that are labeled
    wbsource: 100,102,110,112,806,808
    wbwork: 100 Ops, 102 Ops, 110 Ops, 112 Ops, 806 Ops, 808 Ops

    I don't know how this turns into an object or application-defined error, since neither is being redefined (to my knowledge)
    Please Login or Register  to view this content.
    The code resumes past this to operate and then close the subroutine, but this is the code up until the error.

    Any help would be greatly appreciated!

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Copy Destination between two defined worksheets error

    Hi,

    Try either
    1. Add a 'wbsource.Activate' command between the two copy statements. I wonder if after the 1st copy the wbwork is the activeworkbook.

    2. There's something niggling in my mind that I've seen this before and I seem to remember using a Copy, and then a separate line with Range("B3").PasteSpecial(xlPasteAll) to get round the problem.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Copy Destination between two defined worksheets error

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    11-06-2013
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Copy Destination between two defined worksheets error

    Thank you guys! I got it finally working! I appreciate all your help. I got stuck staring at the same code and couldn't wrap my head around it.

    I used AB33's suggestion and it worked like a charm

+ 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] Error '1004': Application-defined or object-defined error when trying to copy a range
    By TLeng in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-11-2014, 01:35 PM
  2. Replies: 2
    Last Post: 12-15-2013, 04:27 PM
  3. ActiveWorkbook.Worksheets.Name - Apllication-defined or object-defined error
    By CLIOWIWI in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-17-2013, 11:19 AM
  4. Replies: 1
    Last Post: 10-13-2012, 01:47 AM
  5. Copy selected data to a user defined destination
    By kaesuma in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-10-2007, 02:25 PM

Tags for this Thread

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