In the code, Rows.Count returns the number of rows in the
worksheet, or 65536. Therefore, the
..Cells(Rows.Count,2)
refers to the last cell in column 2. Then, the .End(xlUp) causes
Excel to scan upwards until a non-empty cell is found. The .Row
property returns the row number of that last cell.
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
"davegb" <davegb@safebrowse.com> wrote in message
news:1124723331.791232.39630@o13g2000cwo.googlegroups.com...
>I got some help here writing some code. I'm trying to do
>something very
> similar to what this line does, but I don't understand this
> line.
>
> lEndRow = wbkNewHdr.Sheets("Macro Records").Cells(Rows.Count,
> 2) _
> .End(xlUp).Row
>
> I know it defines the final row in the named worksheet. What I
> don't
> understand is what the .Count does, or why the xlUp is not a
> xlDown.
> Can someone explain this line for me?
> Thanks!
>
Bookmarks