View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
MikeZz MikeZz is offline
external usenet poster
 
Posts: 152
Default 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