Last Cell in a Named Range
Last Cell in a Named Range
(OP)
Hello everyone,
How can i reference the last cell in a named range of cells?
I have a range, it is a part of one column, it is named say, "XYZ" I can get to the vaious cells by using
Range("XYZ").Cells(i)
how can I, Or, Can I, reference the last cell in the range right off the bat, somehow?
Thank you
FM
VBA is making more sense by the day and begining to prove invaluble to a structural engineer.
How can i reference the last cell in a named range of cells?
I have a range, it is a part of one column, it is named say, "XYZ" I can get to the vaious cells by using
Range("XYZ").Cells(i)
how can I, Or, Can I, reference the last cell in the range right off the bat, somehow?
Thank you
FM
VBA is making more sense by the day and begining to prove invaluble to a structural engineer.





RE: Last Cell in a Named Range
For Each c In Range("range")
c.Select
Next c
will stop on the last cell of the range
TTFN
RE: Last Cell in a Named Range
RE: Last Cell in a Named Range
Try this in your code:
LASTROW = Range("XYZ").Count
RE: Last Cell in a Named Range
In excel it can be done as follows:
=+INDEX(myrange,ROWS(myrange))
This assumes that myrange defines a range of cells 1 column wide and several rows tall. For the transpose situation, use COLS.
=====================================
Eng-tips forums: The best place on the web for engineering discussions.
RE: Last Cell in a Named Range
The most general case (more than one row or column) can be handled by:
=+INDEX(myrange,ROWS(MYRANGE2),COLUMNS(myrange))
=====================================
Eng-tips forums: The best place on the web for engineering discussions.