+ Reply to Thread
Results 1 to 11 of 11

runtime error 1004 pastespecial method of range class failed

  1. #1
    Registered User
    Join Date
    03-27-2009
    Location
    Washington, D.C.
    MS-Off Ver
    Excel 2007
    Posts
    7

    runtime error 1004 pastespecial method of range class failed

    I am encountering this error when I try to run code I have written on my own machine. I am working with all unprotected sheets, and I am running Excel 2007. All of the sheet exist.

    Here is my code:

    Please Login or Register  to view this content.
    Thanks~ Jh

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: runtime error 1004 pastespecial method of range class failed

    Quite apart from anything else, you need to first tell Excel what you want to paste. If you were doing it manually, you'd do Copy and then Paste wouldn't you.

  3. #3
    Registered User
    Join Date
    03-24-2009
    Location
    New York
    MS-Off Ver
    Excel 2003
    Posts
    25

    Re: runtime error 1004 pastespecial method of range class failed

    I think the problem is with the range. Try this for your pasting line.

    Please Login or Register  to view this content.
    I tried it like you had it and got the same error, then tried the above code and it worked. I'm using Excel 2003.
    Oh you wanted the elegant solution? Sorry, that's extra!

  4. #4
    Registered User
    Join Date
    03-27-2009
    Location
    Washington, D.C.
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: runtime error 1004 pastespecial method of range class failed

    Right Stephen. I am not having any problem with the copying part.

    And I am able to copy a value from a field and put it into a variable, and then spit it out into a cell using
    Please Login or Register  to view this content.
    However, I am unable to get the PasteSpecial or Paste commands to work.

    I hope this explains more.

    Thanks! Jh

  5. #5
    Registered User
    Join Date
    03-27-2009
    Location
    Washington, D.C.
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: runtime error 1004 pastespecial method of range class failed

    bitterenemy,

    i tried your suggestion for the range, and now the error i recieve is pretty much the same, but more generic: '1004' application or object-defined error.

    thanks~ Jh

  6. #6
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: runtime error 1004 pastespecial method of range class failed

    But you're not copying anything!

  7. #7
    Registered User
    Join Date
    03-27-2009
    Location
    Washington, D.C.
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: runtime error 1004 pastespecial method of range class failed

    Stephen,

    I realize that I have not copied anything in the code that I have posted before... I assure you that the copy function is working just fine. Here is my code that copies, as I have said before, the problem I am having is with pasting the row that I've copied.
    Please Login or Register  to view this content.

  8. #8
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: runtime error 1004 pastespecial method of range class failed

    I appreciate that but it helps if you post all relevant code as is. Now I don't know where this code fits with your previous code. Is the former immediately before the latter? The code works for me but I guess there are other things you are doing.

  9. #9
    Registered User
    Join Date
    03-27-2009
    Location
    Washington, D.C.
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: runtime error 1004 pastespecial method of range class failed

    Please Login or Register  to view this content.
    Notes:
    I have kept all the methods I've tried for the paste special and just commmented them and numbered them, and noted the errors I've been getting.
    The only one that works is #3, however, this does not paste the whole row, it pastes the value in the second column only.

    Thanks~ Jh

  10. #10
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: runtime error 1004 pastespecial method of range class failed

    You appear to refer to strcurrCellAddr before it's defined in your code? It might be easier if you can simply explain what you're trying to achieve and perhaps attach a small sample workbook.

  11. #11
    Registered User
    Join Date
    03-27-2009
    Location
    Washington, D.C.
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: runtime error 1004 pastespecial method of range class failed

    So, I've been looking around and I think I've figured out why I'm getting this error.... because the buffer is immediately erased when I select the second sheet- and there is nothing on the clipboard/buffer to paste!

    thought you all might like an update.

    many thanks! Jh

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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