M Michael Allen Jul 5, 2004 #1 I would like to determine the maximum row and column references for a selected range of cells, Thanks, Mike
I would like to determine the maximum row and column references for a selected range of cells, Thanks, Mike
J JE McGimpsey Jul 5, 2004 #2 One way: Dim nLastRow As Long Dim nLastCol As Long With Selection nLastRow = .Item(.Count).Row nLastCol = .Item(.Count).Column End With
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 Jul 5, 2004 #3 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.
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.