none
LastRow reference RRS feed

  • Question

  • It appears that this is not listed in my references.  How can I get it? And why wouldn't it be??

    Thanks.

    Wednesday, December 17, 2014 2:37 PM

Answers

  • Point well taken. That should have been a built-in property of a worksheet object.

    Instead, you can determine this several ways, one of which is Worksheets(1).UsedRange.Rows.Count

    Wednesday, December 17, 2014 3:21 PM
  • SW,

    Re:  used range rows count

    "Worksheets(1).UsedRange.Rows.Count"  will work most of the time.
    But the used range does not always start in Row 1.
    So, something like this is preferred...
        LastRow = Worksheets(1).UsedRange.Rows(Worksheets(1).UsedRange.Rows.Count).Row

    '---
    Jim Cone
    Portland, Oregon USA
    https://goo.gl/IUQUN2 (Dropbox)
    (free & commercial excel add-ins & workbooks)

    Wednesday, December 17, 2014 4:08 PM

All replies

  • Point well taken. That should have been a built-in property of a worksheet object.

    Instead, you can determine this several ways, one of which is Worksheets(1).UsedRange.Rows.Count

    Wednesday, December 17, 2014 3:21 PM
  • SW,

    Re:  used range rows count

    "Worksheets(1).UsedRange.Rows.Count"  will work most of the time.
    But the used range does not always start in Row 1.
    So, something like this is preferred...
        LastRow = Worksheets(1).UsedRange.Rows(Worksheets(1).UsedRange.Rows.Count).Row

    '---
    Jim Cone
    Portland, Oregon USA
    https://goo.gl/IUQUN2 (Dropbox)
    (free & commercial excel add-ins & workbooks)

    Wednesday, December 17, 2014 4:08 PM