+ Reply to Thread
Results 1 to 3 of 3

Cannot copy&paste chart to new sheet (runtime 1004 error)

  1. #1
    Registered User
    Join Date
    09-29-2008
    Location
    australia
    Posts
    25

    Question Cannot copy&paste chart to new sheet (runtime 1004 error)

    Hi Members,

    OK, this is ridiculous....I feel very incompetent right about now.

    Using the macro recorder, I am attempting to copy a chart from one sheet and paste it into "sheet2" (as a chart, not a picture etc). This is the code it generates (excel 2007).

    Please Login or Register  to view this content.
    I continually get a 'Run-time error 1004: paste method of worksheet class failed' message.


    From searching around, it seems that a lot of people have similar problems, for which people have suggested a multitude of possible solutions.

    However, no matter how I modify the code in accordance with those suggestions, nothing works!!!

    What's up with this crazy behavior??

    Thanks for any advice.
    Last edited by bubastisbastet; 02-13-2010 at 08:00 AM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,431

    Re: Cannot copy&paste chart to new sheet (runtime 1004 error)

    Your code worked for me.

    Does this alternative work for you?
    Please Login or Register  to view this content.
    Or this
    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    09-29-2008
    Location
    australia
    Posts
    25

    Re: Cannot copy&paste chart to new sheet (runtime 1004 error)

    Quote Originally Posted by Andy Pope View Post
    Your code worked for me.

    Does this alternative work for you?
    Please Login or Register  to view this content.
    Or this
    Please Login or Register  to view this content.
    Hi Andy,

    Both of those codes worked well for me. A big THANKS.

    Oddly, the code I posted worked OK in Excel 2002 but not 2007.

    For the benefit of others, here is the final code:

    (copy chart 1 in sheet 1, check to see if a previous copy exists in sheet 2, delete it if it does, then paste the newly copied chart into sheet 2, resize it and deselect it)

    Please Login or Register  to view this content.

    I have one question though:

    I notice that every time I reiteratively copy&paste a chart ("Chart 1") from sheet 1 to sheet 2, the chart in sheet 2 becomes sequentially numbered rather than being consistently numbered as simply "Chart 2".

    Is there any way of being able to fix the numbering such that it does not increase sequentially with each successive iteration of the macro execution?

    I want to do this because I'd like to be able to consistently refer to the newly pasted Chart elsewhere.
    Last edited by bubastisbastet; 02-13-2010 at 07:59 AM. Reason: forgot to add something

+ Reply to Thread

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