So I added all the measure you listed initially
Including Table and Named Ranges intersections
As well as the Verbose answer options as well
eg:
=Range_properties(B2:H21,"NC")
=The Range: $B$2:$H$21 is 7 columns wide.
=Range_properties(B2:H21,"NC", false)
=7
and you can use Named Formula
=Range_properties(Test,"NC")
where test = B2:H21 etc
Code below
==================
Function Range_Properties(Area As Range, _
Optional Scope As Variant = "UL", _
Optional Verb As Boolean = True) _
As Variant
'
' Use =Range_Properties(Range, [Scope], [Verbose])
'
' Scope
' UL - Upper Left Cell (Default)
' LL - Lower Left Cell
' UR - Upper Right Cell
' LR - Lower Right Cell
' ALR - Absolute Last row
' ALC - Absolute Last Column
' RLR - Relative Last row
' RLC - Relative Last Column
' HF - Has a Formula
' HB - Has a Blank
' NR - Number Columns
' NC - Number Columns
' Name - Check if intersecting a Named Range/Formula
' Table - Check if intersecting a Table
'
' Verbose
' True - Long Answer (Default)
' False - Short Answer
Dim nm As Name
Dim oLo As ListObject
Dim curRange As Range
Set curRange = Selection
Dim myRng As String
myRng = Area.Address
D1 = 1
D2 = InStr(2, myRng, "$"
![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
D3 = InStr(D2 + 1, myRng, "$"
![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
D4 = InStr(D3 + 1, myRng, "$"
![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
myLen = Len(myRng)
Set rgLast = Range(myRng).SpecialCells(xlCellTypeLastCell)
lLastRow = Range(myRng).Row + Range(myRng).Rows.Count - 1
lLastCol = Range(myRng).Column + Range(myRng).Columns.Count - 1
Set curLast = Range(myRng).SpecialCells(xlCellTypeLastCell)
curLastRow = curRange.Row
curLastCol = curRange.Column
Select Case Scope
Case "UL"
'UL Corner Cordinates
msg = "Top Left = "
If Verb = True Then
Range_Properties = msg + Left(myRng, InStr(1, myRng, ":"
![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
- 1)
Else
Range_Properties = Left(myRng, InStr(1, myRng, ":"
![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
- 1)
End If
Case "UR"
'UR Corner Cordinates
msg = "Top Right = "
If Verb = True Then
Range_Properties = msg + Mid(myRng, D3, D4 - D3) + Mid(myRng, D2, D3 - D2 - 1)
Else
Range_Properties = Mid(myRng, D3, D4 - D3) + Mid(myRng, D2, D3 - D2 - 1)
End If
Case "LL"
'LL Corner Cordinates
msg = "Lower Left = "
If Verb = True Then
Range_Properties = msg + Left(myRng, D2 - 1) + Right(myRng, myLen - D4 + 1)
Else
Range_Properties = Left(myRng, D2 - 1) + Right(myRng, myLen - D4 + 1)
End If
Case "LR"
'LL Corner Cordinates
msg = "Bottom Right = "
If Verb = True Then
Range_Properties = msg + Right(myRng, Len(myRng) - InStr(1, myRng, ":"
![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
)
Else
Range_Properties = Right(myRng, Len(myRng) - InStr(1, myRng, ":"
![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
)
End If
Case "ALR"
'Absolute Last Row
msg = "Last Row = Row: "
If Verb = True Then
Range_Properties = msg + Right(myRng, myLen - D4)
Else
Range_Properties = Right(myRng, myLen - D4)
End If
Case "ALC"
'Absolute Last Column
msg = "Last Column = Column: "
If Verb = True Then
Range_Properties = msg + Mid(myRng, D3 + 1, D3 - D2 - 2)
Else
Range_Properties = Mid(myRng, D3 + 1, D3 - D2 - 2)
End If
Case "RLR"
'Relative Last Row & Column
msg = "There are " + Str(curLastRow - lLastRow) + " Rows between current cell " + Selection.Address + " and the Last Row of " + myRng
If Verb = True Then
Range_Properties = msg
Else
Range_Properties = curLastRow - lLastRow
End If
Case "RLC"
'Relative Last Row & Column
msg = "There are " + Str(curLastCol - lLastCol) + " Columns between current cell " + Selection.Address + " and the Last Column of " + myRng
If Verb = True Then
Range_Properties = msg
Else
Range_Properties = curLastCol - lLastCol
End If
Case "HF"
'Determine if Contains a Formula
HasFormula = False
For Each c In Range(myRng)
If c.HasFormula = True Then
HasFormula = True
Exit For
End If
Next
If HasFormula Then
msg = "Range: " + myRng + " has a formula"
Else
msg = "Range: " + myRng + " Doesn't have a formula"
End If
If Verb = True Then
Range_Properties = msg
Else
Range_Properties = False
End If
Case "HB"
'Determine if Contains a Blank
HasBlank = False
For Each c In Range(myRng)
If c.Text = "" Then
HasBlank = True
Exit For
End If
Next
If HasBlank Then
msg = "Range: " + myRng + " has a Blank cell"
Else
msg = "Range: " + myRng + " Doesn't have a Blank cell"
End If
If Verb = True Then
Range_Properties = msg
Else
Range_Properties = False
End If
Case "NR"
'Number of Rows
msg = "The Range: " + myRng + " is " + Str(Range(myRng).Rows.Count) + " rows high."
If Verb = True Then
Range_Properties = msg
Else
Range_Properties = Range(myRng).Rows.Count
End If
Case "NC"
'Number of Columns
msg = "The Range: " + myRng + " is " + Str(Range(myRng).Columns.Count) + " columns wide."
If Verb = True Then
Range_Properties = msg
Else
Range_Properties = Range(myRng).Columns.Count
End If
Case "Name"
msg = False
For Each nm In ThisWorkbook.Names
Set rng = Intersect(Area, Range(nm.Name))
If Not rng Is Nothing Then
msg = "The range: " + Area.Address + " intersects the Named Range: " & nm.Name
Exit For
End If
Next nm
If Verb = True Then
Range_Properties = msg
Else
If Not rng Is Nothing Then
Range_Properties = True
Else
Range_Properties = False
End If
End If
Case "Table"
msg = False
For Each oLo In ActiveSheet.ListObjects
Application.Goto oLo.Range
Set rng = Intersect(Area, oLo.DataBodyRange)
If Not rng Is Nothing Then
msg = "The range: " + Area.Address + " intersects the Table: " & oLo.Name
Exit For
End If
Next
If Verb = True Then
Range_Properties = msg
Else
If Not rng Is Nothing Then
Range_Properties = True
Else
Range_Properties = False
End If
End If
'Add more functions here
Case Else
Range_Properties = "!Unknown Function"
End Select
End Function