Warn if no text in clipboard contents

J

John

I have the following sub (Excel 2007):
ActiveSheet.PasteSpecial Format:="Text"

It fails if there is no text to paste. I'd like a MsgBox to prompt the user
if there is no text. How do I do this?

Also, is there some way I can warn if the text will paste to more than one
cell?

Thanks
 
G

Gary''s Student

Function ValueOnly()
if Application.CutCopyMode = False then
msgbox "Nothing to paste"
else
ActiveSheet.PasteSpecial Format:="Text"
End if
End Function
 
A

Alan Moseley

I can help with your first question:-

If Application.ClipboardFormats(1) = -1 Then
MsgBox "Clipboard Empty!"
End If
 
Top