+ Reply to Thread
Results 1 to 7 of 7

pastespecial method of range class failed 1004

  1. #1
    Registered User
    Join Date
    12-17-2013
    Location
    London, England
    MS-Off Ver
    Excel 2007 to 2013
    Posts
    35

    Exclamation pastespecial method of range class failed 1004

    Please help i cant explain how one workbook i have works perfectly with the below code and the other one which looks exactly the same has the "pastespecial method of range class failed 1004" error. Same code however bugs. I have checked the code line for line and on both and they match to the letter adn punctuation etc.

    Any suggestions?

    Please Login or Register  to view this content.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: pastespecial method of range class failed 1004

    Does this need to be in 3 separate subs?

    I think if it was all in one sub and was tidied up a bit you might avoid the error.
    If posting code please use code tags, see here.

  3. #3
    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: pastespecial method of range class failed 1004

    Hi,

    Do you have 'Option Explicit' before the first procedure?

    Is the sheet to which you're pasting protected, and / or does it have any merged cells.

    Have you tried exporting the module from the workbook that works and importing it to the workbook that doesn't?
    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.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: pastespecial method of range class failed 1004

    This is how the code would look in one sub.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-17-2013
    Location
    London, England
    MS-Off Ver
    Excel 2007 to 2013
    Posts
    35

    Re: pastespecial method of range class failed 1004

    Thank you for all the advice. The problem i had with "Option Explicit" is that when i typed it, it refused to go onto the line above the Sub name. How do you add this line without it flagging error?

  6. #6
    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: pastespecial method of range class failed 1004

    Hi,

    On the face of it there's no reason why it won't be accepted. Is it at the very top of the module before any procedure?

    What error message are you getting?

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: pastespecial method of range class failed 1004

    Option Explicit will not cause errors.

    What it will do is force you to declare all variables which will actually help prevent errors.

    The code I posted will compile and run.

+ 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. Run time error '1004': PasteSpecial method of Range class failed
    By BorisGRU in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-31-2014, 07:09 PM
  2. [SOLVED] VBA Run-time error '1004': PasteSpecial method of Range class failed on 2nd run
    By hydz1213 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 03-05-2013, 11:05 AM
  3. Run-time error '1004' - PasteSpecial method of Range class failed
    By antonf in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 05-10-2010, 04:42 PM
  4. runtime error 1004 pastespecial method of range class failed
    By JillCALIBRE in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-30-2009, 11:31 AM
  5. runtime error 1004 pastespecial method of range class failed
    By dreamz in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-03-2006, 10:57 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