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
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
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
 
Upvote 0

Forum statistics

Threads
1,213,559
Messages
6,114,302
Members
448,564
Latest member
ED38

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top