ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   xlPasteValues is Empty (https://www.excelbanter.com/excel-programming/439742-xlpastevalues-empty.html)

Mike H.

xlPasteValues is Empty
 
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

Bob Phillips[_4_]

xlPasteValues is Empty
 
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

"Mike H." wrote in message
...
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




Mike H.

xlPasteValues is Empty
 
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!

"Bob Phillips" wrote:

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

"Mike H." wrote in message
...
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



.



All times are GMT +1. The time now is 06:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com