Copying, Clipboard and Confusions

Doug Blackwell

New Member
Joined
Apr 13, 2008
Messages
18
The more I think about this the more confused I get.

I have a hidden worksheet that I want users to paste data onto using a button on a main interface worksheet. The data they are pasting will come from their own worksheet which will have indeterminate names, so the button simply uses sheet1.range("a1").PasteSpecial command. However, if they've forgotten to copy (perhaps merely selected), it will give an error. I can error-check on my worksheet if they've copied the wrong data, but not if they copied nothing at all!

So the question becomes, is there any method in VBA to determine if they have copied anything to the clipboard before it gets to the paste command in my code? I'd rather do this check first, than solve it by error trapping, but maybe that's the only solution.

The more I thought about it, the less I realized I understood. Does anyone know whether the vba copy command (Range("a1").copy) is exactly equivalent to copying to the clipboard? Therefore, is PasteSpecial accessing a Windows object and not an Excel object? Before I thought about it I'd assumed "copy" in VBA was independent of the Windows clipboard.

Any help, understanding or direction would be welcome,
Doug.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Hi Doug

You could use:

Code:
If Application.CutCopyMode = False Then Exit Sub
 
Upvote 0
I spent some time yesterday answering a question relating to managing cut/copy data and the clipboard. It may help you understand the subject better. See here.
 
Upvote 0

Forum statistics

Threads
1,215,743
Messages
6,126,615
Members
449,322
Latest member
Ricardo Souza

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