Quantcast
Viewing all articles
Browse latest Browse all 11829

64333^ Loop in VBA will not exceed 64333

I've tried long, double and longlong as datatypes for the vba code below but in all three cases, the loop stops at 64333 and will not continue on. I knew integer wouldn't work, but I don't understand why long didn't. I need to loop through roughly 137,000 rows.  And, no, there are no blank values in column B until the end of the 137,000 records.

Oh, and when I put the cursor over X in debug mode when the codes exits the loop, the value = 64333^.  What's the ^?  Also, there are no errors.  This code doesn't have any error handling in it, but the code that did did not pick up any errors.

See abbreviated code below.  I appreciate the assistance.

Sub UpdateQuotes()
    Dim X As LongLong
    X = 2
    Range("E11").Select
    Do While Sheets("Data").Range("A" & X).Value <> ""
        If Sheets("Data").Range("B" & X).Value = Sheets("Data").Range("B" & X - 1).Value Then
            Sheets("Data").Range("H" & X).Value = 0
            Sheets("Data").Range("I" & X).Value = 0
            Sheets("Data").Range("J" & X).Value = 0
        End If
        X = X + 1
    Loop
    MsgBox "Update completed successfully.", vbOKOnly, "Quote Update"
End Sub


Ross


Viewing all articles
Browse latest Browse all 11829

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>