Problem with pasting - possibly due to project size?

naveed

New Member
Joined
Oct 13, 2006
Messages
7
I have two macros that work independantly, when I call them in succession - I get an error - I traced the error to be located at a line:
Code:
Sheets("BlankOut").Copy After:=Sheets(Sheets.Count)

I am trying to make a copy of the BlankOut sheet at the end of my sheets. The error does not occur right away - to elaborate my input macro basically gets run ten times, and then my outputs start, it will complete the first 3 outputs fine, but on the fourth time around my problem line, it errors out.

My theory on it was that my clipboard was not happy with the amount of copying and pasting going on. By the time I get to the error, my macro has copy and pasted 400+ items, most of which are images (Visio images to be precies). I tried using:

Code:
Application.CutCopyMode = False

Which I grabbed from the macro recorder to clear the clipboard, but in practice it does not seem to work - I stepped through my project with the office clipboard open and did not see it reset ever.

The overall macro works fine on smaller projects, when they get larger I can no longer paste sheets in, and it then jumps to an error. I don't get a run-time error, it just jumps to:

Code:
MyError:
MsgBox ("ERROR")

From

Code:
On Error GoTo MyError

I am a bit perplexed as to what is causing this, while I feel like it has something to do with memory limits of some kind, I do not know how to do the housekeeping needed on the clipboard.

I used the search a bit on the boards, and saw some suggestions on using the line I posted to clear the clipboard but it is not working for me.

Because it works fine if I only have 5 inputs and 5 outputs, and errors out if I have 10 inputs and 10 outputs, I feel like it is running into some limits, any thoughts?

Thanks
Naveed
 

Some videos you may like

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

naveed

New Member
Joined
Oct 13, 2006
Messages
7
After doing some reading, the Application.CutCopyMode = False will only cancel the copy but if I have already pasted the item it won't remove it from the office clipboard.

I think that my problem is a memory limit in the clipboard, what I thought was clearing the clipboard was not, is there any command or sub-routine that can be used to do such a thing?

Thanks
 

Watch MrExcel Video

Forum statistics

Threads
1,114,384
Messages
5,547,634
Members
410,804
Latest member
bluepinky
Top