Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Last Cell in a Named Range

Status
Not open for further replies.

FM1

Structural
Joined
Dec 16, 2001
Messages
67
Location
US
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.
 
A BF&I approach:

For Each c In Range("range")
c.Select
Next c

will stop on the last cell of the range


TTFN



 
Thank you
 

Try this in your code:

LASTROW = Range("XYZ").Count
 
I don't know the vba stuff you guys are talking about.

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.
 
My mistake, the transpose is COLUMNS, not COLS.

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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top