+ Reply to Thread
Results 1 to 5 of 5

Paste method fails in VBA

  1. #1
    Registered User
    Join Date
    10-12-2005
    Posts
    2

    Paste method fails in VBA

    I am trying to paste some 10 rows containing formulas 500 times using Selection.copy and ActiveSheet.paste.
    The macro fails and throws up the error - "Run-time error '1004'. Paste method of Worksheet class failed". (I clean the clipboard after each paste.)

  2. #2
    damorrison
    Guest

    Re: Paste method fails in VBA

    Just a thought, are you placing your active cell closer to the edge of
    the sheet then what your macro was originally recorded as copying or
    pasting,
    Another thought, if you are copying the same range to many sheets; you
    could group all your sheets together and then work on one sheet to
    change all the sheets grouped.
    Click on the sheet tab press Ctrl and click on the sheets you want to
    group once grouped you only have to work on one sheet , when finished,
    just click on any of the grouped sheet tabs and the sheets will ungroup
    Dave


  3. #3
    Registered User
    Join Date
    10-12-2005
    Posts
    2
    I am pasting to the same sheet more than 500 times. The code that I am using is:

    Range("A9:FY17").Select
    Selection.Copy
    curr = 9 * (i + 1)
    Range("A" & curr).Select
    Range("A" & curr) = i + 1
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Call ClearClipboard

  4. #4
    damorrison
    Guest

    Re: Paste method fails in VBA

    Hi LaLu,
    I tried to use your macr and ended up with an undefined variable, I
    supose you are trying to get your next cell placement before you paste
    again.
    Here;s a simple macro for copy&paste:
    Range("A9:FY17").copy Destination:=ActiveCell
    Now if you get your loop right for your cell placement you can use the
    above code before your next loop.
    When you record a macro for your cell placement record it as relative
    instead of absolute then your cell selection will go down the proper
    number of rows you require.


  5. #5
    damorrison
    Guest

    Re: Paste method fails in VBA

    I will check in the morning to see how you have done< I have been doing
    some reading have have a couple of ideas
    dave


+ 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