Determine exctent of selected range

  • Thread starter Thread starter Michael Allen
  • Start date Start date
M

Michael Allen

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

Thanks,
Mike
 
One way:

Dim nLastRow As Long
Dim nLastCol As Long
With Selection
nLastRow = .Item(.Count).Row
nLastCol = .Item(.Count).Column
End With
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top