ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error'9': Can I create a msgbox for the user? (https://www.excelbanter.com/excel-programming/387746-error9-can-i-create-msgbox-user.html)

Dave M[_2_]

Error'9': Can I create a msgbox for the user?
 
I am getting an Error '9'. I know why this is happening, but the user will
not. Is there a way that I can show a msg box instead of the errorcode?

Vergel Adriano

Error'9': Can I create a msgbox for the user?
 
Dave,

If you have error handlers in your code, you'd be able to show a different
message for the user. for example:

Sub test()
On Error GoTo Error_Handler

Dim i(2) As Integer

i(3) = 3

Exit Sub

Error_Handler:
Select Case Err.Number
Case 9: MsgBox "Subscript out of range!"
Case Else: MsgBox "An unexpected error occurred!"
End Select
End Sub


--
Hope that helps.

Vergel Adriano


"Dave M" wrote:

I am getting an Error '9'. I know why this is happening, but the user will
not. Is there a way that I can show a msg box instead of the errorcode?



All times are GMT +1. The time now is 11:34 AM.

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