Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am currently in the middle of developing a macro which as part of the
routine will use something like Range("A1").PasteSpecial to paste whatever is currently on the clipboard. However, there is not necessarily anything waiting to be pasted and, if this was the case, the above statement would generate a runtime error. Can anyone suggest a way to 1) Detect whether or not there is data on the clipboard, and skip the routine if so or 2) If the macro tries to paste something that's not there, it handles the error and continues to function. Thanks in advance. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You could check the status of the paste button on the Edit Commandbar.
You could just do On Error Resume Next Range("A1").Pastespecial On Error goto 0 this will suppress the error if it occurs. -- Regards, Tom Ogilvy "JakeyC" wrote in message oups.com... I am currently in the middle of developing a macro which as part of the routine will use something like Range("A1").PasteSpecial to paste whatever is currently on the clipboard. However, there is not necessarily anything waiting to be pasted and, if this was the case, the above statement would generate a runtime error. Can anyone suggest a way to 1) Detect whether or not there is data on the clipboard, and skip the routine if so or 2) If the macro tries to paste something that's not there, it handles the error and continues to function. Thanks in advance. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Jakey,
I would use something like: If Application.CutCopyMode Then Range("A1").PasteSpecial xlPasteValues Otherwise, you could end up pasting items from the clipboard that weren't placed there by Excel. HTH, Bernie MS Excel MVP "JakeyC" wrote in message oups.com... I am currently in the middle of developing a macro which as part of the routine will use something like Range("A1").PasteSpecial to paste whatever is currently on the clipboard. However, there is not necessarily anything waiting to be pasted and, if this was the case, the above statement would generate a runtime error. Can anyone suggest a way to 1) Detect whether or not there is data on the clipboard, and skip the routine if so or 2) If the macro tries to paste something that's not there, it handles the error and continues to function. Thanks in advance. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
An even neater solution than I requested!
Thanks a lot to you both. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
PasteSpecial Error 1004? | Excel Discussion (Misc queries) | |||
PasteSpecial Method Error | Excel Discussion (Misc queries) | |||
Error handling with a handling routine | Excel Programming | |||
PasteSpecial error | Excel Programming | |||
PasteSpecial Error | Excel Programming |