(Solved) – UsedRange loop bigger than anticipated


I have a table with 22 rows where I want to go through column B only. My loop goes beyond the 22 rows and reaches 259 for some reason.


Debug.Print "Starting..."
Dim tempRange As Range
Set tempRange = Sheet18.UsedRange.Columns("B")

Dim i As Integer
i = 0
For Each Cell In tempRange.Cells
    i = i   1
Next Cell
Debug.Print "Count: " & i

Intermediate Window

Count: 259

Screenshot showing Sheet18 with 22 rows

Table with 22 rows

Screenshot showing table reference with 22 rows

Table reference showing 22 rows

Leave a Reply

Your email address will not be published. Required fields are marked *