ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error handling (https://www.excelbanter.com/excel-programming/278994-error-handling.html)

Tim C

Error handling
 
What I would like to do:

If Not IsError(ChDir [B5]) Then
ChDir [B5]
more code
End If

But of course IsError isn't for this kind of error. How should I do it?

Thanks,
Tim C



Bob Kilmer

Error handling
 
On Error Resume Next
ChDir [B5]
If Err.Number = 0 Then
'more code
Debug.Print "ok"
Else
'deal w/error
Debug.Print Err.Number
End If


--
Bob Kilmer


"Tim C" wrote in message
...
What I would like to do:

If Not IsError(ChDir [B5]) Then
ChDir [B5]
more code
End If

But of course IsError isn't for this kind of error. How should I do it?

Thanks,
Tim C






All times are GMT +1. The time now is 03:19 AM.

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