RE: What does this do?



the rows.ccount returns the number of rows in the spreadsheet (65,536). The
..end(xlUp) travels up from this row to the first non-blank cell. Personally
(and this is a personal preference) I would write that line like this...

lEndRow = wbkNewHdr.Sheets("Macro Records").Range("B65536") _
..End(xlUp).Row

because in my opionion
Range("B65536") is far more clear to read than Cells(Rows.Count, 2)
--
HTH...

Jim Thomlinson


"davegb" wrote:

> 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!
>
>
.



Relevant Pages

  • Auto input days of week
    ... I'm looking to set up a spreadsheet where users enter new months ... date in cell A1, I have worked out how to auto input dates down the ... Prev by Date: ...
    (microsoft.public.excel.misc)
  • VBA - Last Cell In A Row
    ... How can I find the last cell in a row? ... I have this spreadsheet ... ajocius's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=17695 ... Prev by Date: ...
    (microsoft.public.excel.programming)
  • X=1 Help!!!
    ... I have a spreadsheet where I have a cell NAMED "Free". ... prhrmk's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=23934 ... Prev by Date: ...
    (microsoft.public.excel)
  • Re: Auto input days of week
    ... I'm looking to set up a spreadsheet where users enter new months ... >date in cell A1, I have worked out how to auto input dates down the ... Prev by Date: ...
    (microsoft.public.excel.misc)
  • Re: Excel 2007 high cpu usage, format cell, wrap text
    ... When she highlights the whole spreadsheet, and selects Format ... If the data cells are all contiguous, select any cell in the range and press ... This is necessary as Excel 2007 uses a lot of page memory. ...
    (microsoft.public.excel.misc)