Excel isn't looping up the worksheet I wouldn't think. My guess is it knows
where things are. I wouldn't be concerned that it would be much slower.
If Val(Application.Version) <12 Then
'not in Excel 2007
LastUsedRow = cells(Rows.Count,1).End(xlup).row
Else
'in Excel 2007 (or later)
LastUsedRow = cells(Rows.CountLarge,1).End(xlup).row
End If
I would guess - although I don't have xl2007 readily available to test it.
Note the use of CountLarge.
Well the last used cell in a column would always be within the
worksheet's UsedRange. If Excel's object model automatically moves up
to the UsedRange before actually checking cell contents, no big deal
in XL2007.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.