Link to home
Start Free TrialLog in
Avatar of Euro5
Euro5Flag for United States of America

asked on

VBA overflow runtime error 6

I am getting runtime error 6.
Overflow

I panic here, can anyone help?

Sub delbadzones()
    Dim Max     As Integer
    Dim Row     As Integer

    Max = Cells(ActiveSheet.Rows.Count, 1).End(xlUp).Row

    For Row = Max To 2 Step -1
        Cells(Row, 1).Select
        Select Case UCase(Cells(Row, 1).Value)
            Case "GR", "HD", "MWT"
                If Cells(Row, 3).Value < 2 Or Cells(Row, 3) > 8 Then
                    Cells(Row, 1).EntireRow.Delete
                End If
        End Select
    Next Row
End Sub

Open in new window

Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Which line gives the error? BTW you don't need line 8.
Avatar of Euro5

ASKER

Line 5
ASKER CERTIFIED SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
if that's the case then Row will need to be declared as Long as well.
You're absolutely right.
Avatar of Euro5

ASKER

Now running - thanks!
You're welcome and I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2015