+ Reply to Thread
Results 1 to 12 of 12

Runtime error '1004': Paste special method of range class error.

  1. #1
    Registered User
    Join Date
    10-29-2014
    Location
    Calgary, Alberta
    MS-Off Ver
    2013 Home
    Posts
    7

    Smile Runtime error '1004': Paste special method of range class error.

    Trying to filter a few numbers from a larger group of numbers in one cell, copy them, then paste them in another cell. Error comes up as "Runtime error '1004': Paste special Method of Range class fail". When I go to "debug", it shows this:

    Please Login or Register  to view this content.


    How can I get my macro to cut and paste what I want without this error? The macro does EVERYTHING I asked of it, except paste. Thanks
    Attached Files Attached Files
    Last edited by alansidman; 10-30-2014 at 02:47 AM. Reason: To simplify document

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Runtime error '1004': Paste special method of range class error.

    Do you mean like this?

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-29-2014
    Location
    Calgary, Alberta
    MS-Off Ver
    2013 Home
    Posts
    7

    Re: Runtime error '1004': Paste special method of range class error.

    Yes, like that. Sorry. It was the second bug I had in there and for some reason it initially came up like I originally posted. I ran it a second time and it came up as you posted stnkynts.

  4. #4
    Registered User
    Join Date
    10-29-2014
    Location
    Calgary, Alberta
    MS-Off Ver
    2013 Home
    Posts
    7

    Re: Runtime error '1004': Paste special method of range class error.

    Sorry, speedread your doc. I re-ran it and the debug screen is coming up like this:

    Please Login or Register  to view this content.
    The "ActiveSheet.Paste" is yellow highlighted with a yellow arrow to the left.
    Last edited by alansidman; 10-30-2014 at 02:47 AM. Reason: clarity

  5. #5
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Runtime error '1004': Paste special method of range class error.

    The code you submitted in your most recent post is just your initial post again. I took out the ActiveSheet.Paste that you are referring to. I am confused at this point as to what you are doing.

  6. #6
    Registered User
    Join Date
    10-29-2014
    Location
    Calgary, Alberta
    MS-Off Ver
    2013 Home
    Posts
    7

    Re: Runtime error '1004': Paste special method of range class error.

    I am SO sorry stnkynts. I was in a hurry and had to leave. I re-ran the macro, and when I viewed it again in debug, the window didn't show the beginning of the code. And I didn't scroll to the top, so I thought it was showing me a different code than I initially pasted. I'm not used to reading code closely and thought what I cut and pasted was different. By the time I realized I posted the same code, I had to go out somewhere. I'm sorry for confusing you as the re-paste was obviously my fault.

    ANYWAY, what I am TRYING to do is to create a macro that filters out all the green highlighted data from column "A" in the attached excel sheet, and paste it into F4-F15. I thought I did it right as my macro seemed to execute everything except the pasting part at the end. That's when it sent me the error code. Do I need in my macro to separately paste formulas and THEN paste values as my last steps before I stopping recording? Or do I use some other paste function at the end?

    If you could list each step I need to to create the macro to accomplish the above task, that might be easiest. My knowledge of Excel is only intro level as that's the only course I've taken on it. I thought I'd try doing a macro despite my inexperience, but obviously forgot to do something when creating it. And I have almost no idea what I'm looking at in debug screen to fix this problem there.

    And again, sorry for confusing you. And thanks for your assistance.

  7. #7
    Administrator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs
    MS-Off Ver
    MS Office 365 Version 2211 (Build 15813.20002) Win 11 Home 64 Bit
    Posts
    22,085

    Re: Runtime error '1004': Paste special method of range class error.

    Daryl Zer0

    Code Tags Added
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (Because you are new to the forum, I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    Alan


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  8. #8
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Runtime error '1004': Paste special method of range class error.

    I don't get the error when I test on your submitted sheet.
    The code copies the green data in column A to column F as you specified.

    I don't know what is going wrong on your end.

  9. #9
    Registered User
    Join Date
    10-29-2014
    Location
    Calgary, Alberta
    MS-Off Ver
    2013 Home
    Posts
    7

    Re: Runtime error '1004': Paste special method of range class error.

    stnkynts, did you download your version of Microsoft Office? I bought mine on disc in a store. Maybe my copy's defective and yours isn't.

    This is exactly how I tried to create my macro:

    Selected "View tab"
    Selected "Record Macro" tab (use relative references tab not highlighted)
    Macro name: Macro1
    Short cut Key: Ctrl + "m"
    Store macro in: this workbook
    Select f4-f16
    right click and select clear contents
    click on filter tab in column "A"
    select filter by color
    select green
    select "a8-a239"
    right click and select "copy"
    click on filter tab in column "A"
    select clear filter from "column A"
    select f4-f16
    right click and select "paste"
    click on stop button to stop recording macro.

    Then to run macro I:

    view macros
    select macro1
    click on "run"

    Then it executes everything I did in my macro EXCEPT "paste". That's when I get the run-time error code '1004' paste special method of worksheet class failed.

    It seems to me I did everything right but it didn't work. And when I copied and pasted the code you have above in my debug, it works for columns above but wont work if I try the same thing for other columns when I create a macro for them to do the same thing. Like for example with column's "G" or "H".

    So I don't know what's wrong too.

  10. #10
    Registered User
    Join Date
    10-29-2014
    Location
    Calgary, Alberta
    MS-Off Ver
    2013 Home
    Posts
    7

    Re: Runtime error '1004': Paste special method of range class error.

    Thanks for the info alansidman. I'll look into it.

  11. #11
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Runtime error '1004': Paste special method of range class error.

    Maybe my copy's defective and yours isn't.
    Your copy is just fine.

    Selected "Record Macro" tab
    You no longer need to record a macro, I am giving you the entire code. Open up the Visual Basic Editor. Right click on "ThisWorkbook" -> Insert -> Module. Paste the code below into the new module. Back in Excel, on the ribbon under the Developer Tab, click macros then run the macro "Create_Data". Should do what you are asking

    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    10-29-2014
    Location
    Calgary, Alberta
    MS-Off Ver
    2013 Home
    Posts
    7

    Re: Runtime error '1004': Paste special method of range class error.

    Thanks for the fix stnkynts.

+ 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. runtime error 1004 paste method of worksheet class failed
    By richard83 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-11-2014, 10:32 AM
  2. Run time error: 1004 Paste special method of range class failed
    By amethystfeb in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-23-2014, 02:04 AM
  3. runtime error 1004 - paste method of worksheet class failed
    By fmxwannabe in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-26-2014, 09:32 PM
  4. [SOLVED] VBA Error: Runtime Error 1004: AutoFilter method of Range class failed
    By jl22stac in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-03-2013, 07:27 PM
  5. [SOLVED] Runtime error 1004 paste method of worksheet class failed
    By Castillb in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-02-2013, 07:31 PM

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