PDA

View Full Version : Solved: Finding the rows of a Selection



GlazedIZ
10-29-2009, 03:50 PM
How do I find the last row number of a selection?

Selection.Row seems to give me the 1st row, but I can't figure out the syntax for the count of the rows or the last row, or even the range address. (actually all I need is the last row, just trying to find something to help me calculate it)

mdmackillop
10-29-2009, 03:57 PM
MsgBox Selection.Row + Selection.Rows.Count - 1

lucas
10-29-2009, 03:59 PM
One way:

Sub a()
Dim rng As Range
Set rng = ActiveSheet.UsedRange
MsgBox rng(rng.Count).Row
End Sub

lucas
10-29-2009, 04:00 PM
I misunderstood the question. Please ignore.

GlazedIZ
10-29-2009, 04:03 PM
perfect - thanks.

I didnt think rows.count would work since I couldn't find it in my "watch" of the selection object.

GlazedIZ
10-29-2009, 04:07 PM
how do I mark this thread solved?

Aussiebear
10-29-2009, 05:03 PM
Above your initial post is a drop down list headed by Thread Tools. Within that listing should be an option to Mark Thread Solved.