Runtime error "6" Overflow.
needhelp
-
yg_be Posted messages 23437 Registration date Status Contributeur Last intervention -
yg_be Posted messages 23437 Registration date Status Contributeur Last intervention -
Hello,
I am currently creating a macro that allows me to delete rows from a column. However, when I try to run it, the error message: "runtime error '6' Overflow." appears.
Here is my program.
Sub Button1()
Dim i As Integer
With ThisWorkbook.Sheets("Sheet1")
For i = .Range("B" & .Rows.Count).End(xlUp).Row To 2 Step -1
If .Range("B" & i).Value = "C00001" Then
.Rows(i).Delete
End If
Next i
End With
End Sub
Can you help me?
Thank you in advance
Configuration: Windows / Chrome 67.0.3396.87
I am currently creating a macro that allows me to delete rows from a column. However, when I try to run it, the error message: "runtime error '6' Overflow." appears.
Here is my program.
Sub Button1()
Dim i As Integer
With ThisWorkbook.Sheets("Sheet1")
For i = .Range("B" & .Rows.Count).End(xlUp).Row To 2 Step -1
If .Range("B" & i).Value = "C00001" Then
.Rows(i).Delete
End If
Next i
End With
End Sub
Can you help me?
Thank you in advance
Configuration: Windows / Chrome 67.0.3396.87
you need to declare a long integer
Long Numeric Integer from -2147483648 to 2147483647.
Thank you for this advice, I changed "Dim i As Integer" to "Dim i As Long" but now it shows me a new error message haha; this one: "Runtime Error '13': Type mismatch".
My last row is at 1,048,576.
There's a problem, you have 1,048,576 non-empty cells!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!