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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

simple Excel range properties question 1

Status
Not open for further replies.

larryww

Programmer
Mar 6, 2002
193
US
How do you get the height (in rows) and width (in columns) of a range?

If I have function MyFunction(rngA as range) then I gather that rngA.row and rngA.column give the top and left coordinates; what property gives the bottom and right? I see that I can use rngA.rows(3), which is great, but I'm still need that final piece.

Moreover, if a range is C4:E9, then I would like to receive either 6(the number of rows), or 9 (the bottom row), or both.

Thanks very much.
 
Hi,

With rngA
FirstRow = .Row
FirstCol = .Column
RowCount = .Rows.Count
ColCount = .Columns.Count
End With

LastRow = FirstRow + RowCount - 1
LastCol = FIrstCol + ColCount - 1

Hope this helps :) Skip,
metzgsk@voughtaircraft.com
 
Ahhh .count.

Thanks - thorough and useful.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top