Re: Overstepping the Error?
The problem is that the purpose of
Code:
On Error Resume Next
is to ignore the error and continue. It does this by setting Err.Number = 0.
You need to use On Error Goto
Like this
Code:
Sub MySub
For v = 0 To CInt(wbRef2.Sheets(1).UsedRange.Columns.Count) - 4 Step 1
Dim stepArray
stepArray = Array(1, 3, 5, 7)
ArrayCheck = Application.Match(v, stepArray)
On Error goto ErrorHandler
End If
Next v
'
'Rest Of your code
'
Exit Sub
ErrorHandler:
If Err.Number > 0 Then
wbRef2.Sheets(1).Range("H3").Offset(0, t) = customarray(t + 1)(d + 1)
t = t + 1
End If
Resume Next
End Sub
Re: Overstepping the Error?
unless you want to change you error handling within the loop, you should place any on error statement prior to the loop
similarly if steparray remains constant it too should be declared and assigned values prior to the loop