Overflow Error in Excel

I'm getting an overflow error in this line:     For i = 2 To Range("B1048576").End(xlUp).Row.  The macro works on another spreadsheet that has more rows than the one I'm trying to run it on now. The other difference I can see is that the spreadsheet where it works has less columns than the one where it doesn't work.

For reference, my spreadsheet has 58830 rows.

Option Explicit
Sub CategorizeAssetType()
    Dim FindWhat, rngCell As Range, i As Integer
    Dim FindWhat2
    Dim FindWhat3


    Dim bFound As Boolean
   
    FindWhat = Array("applicationnote", "application-note", "application note", "appnote", "app-note")
   
    FindWhat2 = Array("guide", "app_guide")
   
    FindWhat3 = Array("brochure")
   
 
    For i = 2 To Range("B1048576").End(xlUp).Row
        bFound = LookUp(FindWhat, "application-note", Cells(i, 2))
        If Not bFound Then
            bFound = LookUp(FindWhat2, "application-spotlight", Cells(i, 2))
        End If
        If Not bFound Then
            bFound = LookUp(FindWhat3, "brochure", Cells(i, 2))
        End If
       
    Next
End Sub
Private Function LookUp(Arr As Variant, Category As String, cel As Range) As Boolean

    Dim lngEntry As Long
   
    For lngEntry = 0 To UBound(Arr)
        If InStr(1, UCase(cel.Value), UCase(Arr(lngEntry))) > 0 Then
            cel.Offset(0, 5).Value = Category
            LookUp = True
            Exit Function
        End If
    Next

End Function
calyx_terenAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Saurabh Singh TeotiaCommented:
Change this line of yours..

Dim FindWhat, rngCell As Range, i As Integer

Open in new window


to this...

Dim FindWhat, rngCell As Range, i As long

Open in new window


Saurabh...
0
calyx_terenAuthor Commented:
Saurabh, it looks like that took care of my overflow error, but now I'm getting a type mismatch error here:
        If InStr(1, UCase(cel.Value), UCase(Arr(lngEntry))) > 0 Then

Can you help?
0
Saurabh Singh TeotiaCommented:
I don't see any problem in the same..Can you post your workbook here..

Saurabh...
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

calyx_terenAuthor Commented:
It's going to take me a while to make a set of dummy data. I'll follow up.
0
calyx_terenAuthor Commented:
Saurabh, here is the dummy data, but I'm not getting the type mismatch error here. It has the same number of rows as my spreadsheet. The differences are in the file names in column B, user emails in column H, and User names in column I.
cca-dummy-data.xlsm
0
calyx_terenAuthor Commented:
Could these characters be causing the error? They are Excel's attempt to translate Japanese characters. If so, how can I prevent the error without having to identify each row that has the characters and deleting it?
据付連絡書_rev08_20130423.xlsx
0
calyx_terenAuthor Commented:
Correction: not Excel's, but Window's attempt to translate Japanese characters.
0
Saurabh Singh TeotiaCommented:
Yeah those characters can lead to the error as windows are not able to read it..Now you can build a exception around it by using an if statement that don't compare or look when it's junk character like this..

Saurabh...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.