Sub WhatsTheNumber()
Dim lngR As Long
lngR = Selection.Rows(Selection.Rows.Count).Row
MsgBox lngR
End Sub
'- or -
Sub SelectRow()
Selection.Rows(Selection.Rows.Count).Select
End Sub
--
Jim Cone
San Francisco, USA http://www.realezsites.com/bus/primitivesoftware
"RalphH" <[email protected]>
wrote in message
Is there a better way of finding the last row of a contiguous range
than:
There are a myriad of situations that would make your suggestion return the
wrong answer for the question asked. Besides that, what makes you think it
is better.
Well the original statement was for [Selection.End(xlDown).Select]
which does not fully encapsulate connecting without a break (which is
what I read the question to be)
The reason I like it… the absolute last row of a sheet will allow for
looping statements to evaluate all of your ranges/cells in question…
In addition, you will not need to consistently save your sheet using
my statement as you would with lets say
[Cells.SpecialCells(xlCellTypeLastCell).Row] or some other methods.
Just personal preference, nothing more.
Well the original statement was for [Selection.End(xlDown).Select]
which does not fully encapsulate connecting without a break (which is
what I read the question to be)
The reason I like it… the absolute last row of a sheet will allow for
looping statements to evaluate all of your ranges/cells in question…
In addition, you will not need to consistently save your sheet using
my statement as you would with lets say
[Cells.SpecialCells(xlCellTypeLastCell).Row] or some other methods.
Just personal preference, nothing more.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.