Get Last Cell of Range
-
-
-
Re: Get Last Cell of Range
Something like this?
CodeSub test() Dim MyRange As Range Set MyRange = Range("D2:D17") MsgBox MyRange(MyRange.Cells.Count).Address End Sub
EDIT: Incidently, this counts the number of cells in the range and then gives the address of the last cell (since the last cell is the element matching the number of cells in the range. This works just as well with two-dimensional arrays are with one-dimensional arrays such as the one you are using.)
-
Re: Get Last Cell of Range
Do you want the lat cell in your named range or the last occupied cell?
-
-
Re: Get Last Cell of Range
Hi
Tom and Norie's solution wil give you the last cell in the named range. A slight modification of Tom's code will give you the last occupied cell in the named range.
CodeSub test() Dim MyRange As Range Set MyRange = Range("A1:A10") MsgBox MyRange(MyRange.Cells.Count).End(xlUp).Address End Sub
Bill
-
-
Re: Get Last Cell of Range
super, thanks!
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!