VBA – Count the rows in a Selection


If you ever need to count the number of rows that were selected, use Selection.Rows.Count

Count Rows in a Selection

Public Sub CountMyRows()

MsgBox Selection.Rows.Count

End Sub

If you ever need to count the number of Columns that were selected, use Selection.Columns.Count

Count Columns in a Selection

Public Sub CountMyColumns()

MsgBox Selection.Columns.Count

End Sub