ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Error Trapping (https://www.excelbanter.com/excel-discussion-misc-queries/157264-error-trapping.html)

gazza67[_2_]

Error Trapping
 
Can someone tell me why the following falls over with a runtime error
when the clipboard is empty (ie I do not get the msgbox)

On Error Resume Next
ActiveSheet.Paste
If Err Then MsgBox "Nothing to paste!": Err.Clear

Thanks,
Gary


Jim Rech

Error Trapping
 
Do you have Break on All Errors set under Tools, Options, General in the
VBE?

--
Jim
"gazza67" wrote in message
ups.com...
| Can someone tell me why the following falls over with a runtime error
| when the clipboard is empty (ie I do not get the msgbox)
|
| On Error Resume Next
| ActiveSheet.Paste
| If Err Then MsgBox "Nothing to paste!": Err.Clear
|
| Thanks,
| Gary
|



gazza67[_2_]

Error Trapping
 
That was it, Thanks so much!!

Gary



On Sep 7, 2:44 am, "Jim Rech" wrote:
Do you have Break on All Errors set under Tools, Options, General in the
VBE?

--
Jim"gazza67" wrote in message

ups.com...
| Can someone tell me why the following falls over with a runtime error
| when the clipboard is empty (ie I do not get the msgbox)
|
| On Error Resume Next
| ActiveSheet.Paste
| If Err Then MsgBox "Nothing to paste!": Err.Clear
|
| Thanks,
| Gary
|





All times are GMT +1. The time now is 08:58 PM.

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