Check if clipboard is empty before pasting
On Feb 3, 12:28*pm, Munchkin
wrote:
I want my macro button to paste what is in the clipboard onto my excel
document, but if the clipboard is empty I want a message to pop up that
states "Your clipboard is empty - retry copying your data." and end the macro.
If there is something in the clipboard it should proceed with pasting it. *
I've tried several things but non of them are working.
* * Cells.Select
* * ActiveSheet.Paste
Try something like the following...Ron
' test to see if the clipboard is empty
If Application.ClipboardFormats(1) = -1 Then
MsgBox "Your clipboard is empty - retry copying your data."
End
Else
Cells.Select
ActiveSheet.Paste
End If
|