Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross 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
Dec 16, 2001
67
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.
 
Replies continue below

Recommended for you

A BF&I approach:

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

will stop on the last cell of the range


TTFN



 

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