tiredofit
Well-known Member
- Joined
- Apr 11, 2013
- Messages
- 1,834
- Office Version
- 365
- 2019
- Platform
- Windows
The code below works fine.
Notice I have commented out the line:
I understand why it fails it is was added in but is it good practice to always add On Error GoTo 0?
If I were to add it in, I would put it here:
Code:
Dim i As Integer
For i = 1 To 100
Dim a As Integer
If i > 1 Then a = 1 / 0
On Error GoTo abc
a = i / 0
cde:
Next i
Exit Sub
abc:
'On Error GoTo 0
Resume cde
Notice I have commented out the line:
Code:
On Error GoTo 0
I understand why it fails it is was added in but is it good practice to always add On Error GoTo 0?
If I were to add it in, I would put it here:
Code:
Dim i As Integer
For i = 1 To 100
Dim a As Integer
If i > 1 Then a = 1 / 0
On Error GoTo abc
a = i / 0
On Error GoTo 0
cde:
Next I
Exit Sub
abc:
'On Error GoTo 0
Resume cde
Last edited: