Determine exctent of selected range

M

Michael Allen

I would like to determine the maximum row and column references for a
selected range of cells,

Thanks,
Mike
 
J

JE McGimpsey

One way:

Dim nLastRow As Long
Dim nLastCol As Long
With Selection
nLastRow = .Item(.Count).Row
nLastCol = .Item(.Count).Column
End With
 
D

Doug Glancy

Michael,

If you mean you'd like to determine the last row and column in the selected
range then this would do it:

MsgBox "last row is" & Selection.Rows(Selection.Rows.Count).Row & vbCr & _
"last column is " &
Selection.Columns(Selection.Columns.Count).Column

If you just want the number of rows or columns in the selection, use the
parts inside the parens.
 
Top