Paste method fails in VBA

L

lalu

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.)
 
D

damorrison

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
 
L

lalu

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
 
D

damorrison

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.
 
D

damorrison

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top