ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Basic Range Question (https://www.excelbanter.com/excel-programming/423441-basic-range-question.html)

MikeZz

Basic Range Question
 
Can someone point me to a set of functions or properties for set ranges?
Specifically I'm looking for the following:

For a range of cells:
Upper & Lower Left Cell Address
Upper & Lower Right Cell Address

Left & Right Column Number
Top & Bottom Row Number

These are probably just properties of a range object but I can't seem to
find them in help... I know it's probably one of those "it's so easy a
Caveman could do it" things that I'm just missing.

Thanks
MikeZz

MikeZz

Basic Range Question
 
Thanks Gary... I know it was easy but just couldn't find the right property.

"Gary''s Student" wrote:

This might be of some help:

Sub range_reporter()
Dim r As Range
Dim s As String
Set r = ActiveSheet.UsedRange

nLastRow = r.Rows.Count + r.Row - 1
MsgBox ("last row " & nLastRow)

nLastColumn = r.Columns.Count + r.Column - 1
MsgBox ("last column " & nLastColumn)

nFirstRow = r.Row
MsgBox ("first row " & nFirstRow)

nFirstColumn = r.Column
MsgBox ("first column " & nFirstColumn)

numrow = r.Rows.Count
MsgBox ("number of rows " & numrow)

numcol = r.Columns.Count
MsgBox ("number of columns " & numcol)

s = r.Address
MsgBox ("address " & s)

s = r(1).Address
MsgBox ("address of first cell " & s)
End Sub
--
Gary''s Student - gsnu200831


"MikeZz" wrote:

Can someone point me to a set of functions or properties for set ranges?
Specifically I'm looking for the following:

For a range of cells:
Upper & Lower Left Cell Address
Upper & Lower Right Cell Address

Left & Right Column Number
Top & Bottom Row Number

These are probably just properties of a range object but I can't seem to
find them in help... I know it's probably one of those "it's so easy a
Caveman could do it" things that I'm just missing.

Thanks
MikeZz



All times are GMT +1. The time now is 02:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com