• Finding last row of a selection (Excel 2000 or 2003)

    Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Finding last row of a selection (Excel 2000 or 2003)

    • This topic has 6 replies, 3 voices, and was last updated 19 years ago.
    Author
    Topic
    #431599

    Hi … so glad this site is back up! …

    I have a macro that can get the first row of a selection of rows with this:
    FirstRow = Selection.Rows

    Now I need to know the EndRow of this selection. (Sorry, I’m working on a PC that did not install the Help … )

    EndRow=Selection.???

    As always, I appreciate any help at all.
    –cat

    Viewing 1 reply thread
    Author
    Replies
    • #1010535

      EndRow = selection.row + selection.rows.count-1

      Steve

      • #1010538

        Steve: That is not going to work if the selection contains more than one area.

        • #1010544

          blush You are, of course, correct. I presumed the selection was contiguous.

          Steve

      • #1010541

        Thanks, Steve. That works. But even better, the Selection.Rows.Count is actually what I’m after (i was going to calculate it by EndRow-StartRow)!
        Thank you,
        –cat

    • #1010536

      I’m not sure what you are after. Selection.Rows returns a range object that includes all of the rows in the current selection. If you really meant Selection.Row, then that would return the row number of the first row in the first area in the current selection.

      Are you looking for the row number of the last row in the current selection? If so, then what do you want if the current selection contains more than one area?

      • #1010542

        Sorry, Legare … I forgot to add that the users will be trained to select entire rows (and the rows will always be contiguous). What I actually needed was a row count of this row selection.

        Thank you both for your help …
        –Cindy

    Viewing 1 reply thread
    Reply To: Finding last row of a selection (Excel 2000 or 2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: