Re: last row of a non-contiguous selection
- From: Ron Rosenfeld <ronrosenfeld@xxxxxxxxxx>
- Date: Fri, 28 Mar 2008 11:08:24 -0400
On Fri, 28 Mar 2008 06:38:00 -0700, Stefi <Stefi@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
Hi All,
I have a one column wide non-contiguous selection. I want to determine the
row No of the last cell in the selection (the highest row No in the
selection).
How can I do that?
Thanks,
Stefi
You do write that you have the entire column selected.
In that case:
=============
Option Explicit
Sub lastrow()
Dim c As Range
Dim lLastRow As Long
Set c = Cells(Selection.Rows.Count, Selection.Column)
Set c = c.End(xlUp)
lLastRow = c.Row
Debug.Print lLastRow
End Sub
======================
or
=====================
Sub lastrow()
Dim lLastRow As Long
lLastRow = Cells(Selection.Rows.Count, Selection.Column).End(xlUp).Row
Debug.Print lLastRow
End Sub
===============
--ron
.
- Follow-Ups:
- Re: last row of a non-contiguous selection
- From: Stefi
- Re: last row of a non-contiguous selection
- References:
- last row of a non-contiguous selection
- From: Stefi
- last row of a non-contiguous selection
- Prev by Date: Re: Input Box selection and file open
- Next by Date: RE: Reading a CSV file into an Excel w/b
- Previous by thread: Re: last row of a non-contiguous selection
- Next by thread: Re: last row of a non-contiguous selection
- Index(es):
Relevant Pages
|