xlPasteValues is Empty

M

Mike H.

How can I test that there is something to paste so that executing this line
of code does not return an error 1004. I am not capturing anything via VBA.
I am just wanting to paste what is in the clipboard. But if nothing is there
I get the error. Thanks!

Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
 
B

Bob Phillips

How about just error wrapping it

On Error Resume Next
Selection.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=False
On Error Goto 0

HTH

Bob
 
M

Mike H.

Gosh, Bob. That was too simple! I will certainly solve it that way. I've
done that many times before but had a senior moment this time, I s'pose!
Thanks!
 

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