Sub Main()
Debug.Print AreaType(Selection)
End Sub
Function AreaType(RangeArea As range) As String
' Returns the type of a range in an area
Select Case True
Case RangeArea.Count = 1
AreaType = "Cell"
Case RangeArea.Count = Cells.Count
AreaType = "Worksheet"
Case RangeArea.Rows.Count = Cells.Rows.Count
AreaType = "Column"
Case RangeArea.Columns.Count = Cells.Columns.Count
AreaType = "Row"
Case Else
AreaType = "Block"
End Select
End Function
|