S
Shetty
Hi all,
I have a code running properly except error handler. Every time the
code runs, error handler is ***always*** executed even if there is no
error.
Can somebody tell me how to escape error handler if there
is no error?
Thanks in advance.
Shetty.
Here is the code.
Private Sub CommandButton1_Click()
pp = ComboBox1.Value
Ref2 = pp
..... other code ... creates some sheets
On Error GoTo err:
..... other code ... creates some sheets
Application.DisplayAlerts = True
Application.ScreenUpdating = True
MsgBox "MIN No " & pp & " Successfully printed."<<< this is last
statment
Set SHT1 = Nothing
Unload Me
err:
Application.DisplayAlerts = True
Application.ScreenUpdating = True
Set SHT1 = Nothing
..... other code ... delete the sheets created.
MsgBox "There was an error generating the MIN." & vbNewLine &
"Please check the data."
Unload Me
Exit Sub
End Sub
I have a code running properly except error handler. Every time the
code runs, error handler is ***always*** executed even if there is no
error.
Can somebody tell me how to escape error handler if there
is no error?
Thanks in advance.
Shetty.
Here is the code.
Private Sub CommandButton1_Click()
pp = ComboBox1.Value
Ref2 = pp
..... other code ... creates some sheets
On Error GoTo err:
..... other code ... creates some sheets
Application.DisplayAlerts = True
Application.ScreenUpdating = True
MsgBox "MIN No " & pp & " Successfully printed."<<< this is last
statment
Set SHT1 = Nothing
Unload Me
err:
Application.DisplayAlerts = True
Application.ScreenUpdating = True
Set SHT1 = Nothing
..... other code ... delete the sheets created.
MsgBox "There was an error generating the MIN." & vbNewLine &
"Please check the data."
Unload Me
Exit Sub
End Sub