+ Reply to Thread
Results 1 to 3 of 3

How can I know what the last row in a selection is?

Hybrid View

djblois1 How can I know what the last... 07-20-2012, 02:32 PM
JBeaucaire Re: How can I know what the... 07-20-2012, 02:45 PM
Andy Pope Re: How can I know what the... 07-21-2012, 05:44 AM
  1. #1
    Forum Contributor
    Join Date
    08-23-2010
    Location
    Staten Island, NY
    MS-Off Ver
    Excel 2003
    Posts
    242

    How can I know what the last row in a selection is?

    If someone selects a range - I would like to know what the bottom of the range is. I used this code:

    Selection.Row + Selection.Rows.Count - 1
    is there a simpler way to know the last row?

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: How can I know what the last row in a selection is?

    That looks simple enough to do the job. What is the problem?
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,480

    Re: How can I know what the last row in a selection is?

    The are many ways to get last row of contiguous selection.

    ?selection.rows(selection.rows.count).row
    ?selection.offset(selection.rows.count).row-1
    ?selection.cells(selection.cells.count).row
    But there is no simple .LastRow property.
    Cheers
    Andy
    www.andypope.info

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1