J
Jo
Guest
Hello,
I'm trying to migrate a macro Excel 2003 to 2007 and I have the
following problem:
When running the code below, Err.Number is always 9 while in 2003
Err.Number is 0:
Public Sub Test ()
Dim i As Long
On Error Resume Next
With ActiveSheet
For i = 1 To 100
. Cells (i, "A"). Value = i
If Err.Number = 0 Then
. Cells (i, "B"). Value = "OK"
Else
. Cells (i, "B"). Value = "KB (" & Err.Number & "-" &
Err.Description & ")"
End If
Err.Clear
Next
End With
End Sub
Is this a BUG VBA 2007 or is it my code that Bugged (in this case why
it works well in 2003?).
Thank you for your help.
I'm trying to migrate a macro Excel 2003 to 2007 and I have the
following problem:
When running the code below, Err.Number is always 9 while in 2003
Err.Number is 0:
Public Sub Test ()
Dim i As Long
On Error Resume Next
With ActiveSheet
For i = 1 To 100
. Cells (i, "A"). Value = i
If Err.Number = 0 Then
. Cells (i, "B"). Value = "OK"
Else
. Cells (i, "B"). Value = "KB (" & Err.Number & "-" &
Err.Description & ")"
End If
Err.Clear
Next
End With
End Sub
Is this a BUG VBA 2007 or is it my code that Bugged (in this case why
it works well in 2003?).
Thank you for your help.