Sub CheckRange()
Dim RngChk As String, Rng1 As String, Rng2 As String
Dim rMax As Long, rMin As Long, cMax As Long, cMin As Long, nTmp As Long
Dim vt1 As Long, vt2 As Long, ten As String, kytu As String
On Error Resume Next
Rng1 = Selection.SpecialCells(xlCellTypeConstants, 23).Address(, , xlR1C1)
Rng2 = Selection.SpecialCells(xlCellTypeFormulas, 23).Address(, , xlR1C1)
RngChk = Rng1 & "," & Rng2 & "Z"
rMin = Cells.Rows.Count
cMin = Cells.Columns.Count
vt1 = 1
Do
ten = Mid(RngChk, vt1, 1)
If ten = "R" Or ten = "C" Then
vt1 = vt1 + 1
vt2 = vt1
Do
kytu = Mid(RngChk, vt2, 1)
If IsNumeric(kytu) = False Then
' Stop
nTmp = Mid(RngChk, vt1, vt2 - vt1)
If nTmp > rMax And ten = "R" Then rMax = nTmp
If nTmp < rMin And ten = "R" Then rMin = nTmp
If nTmp > cMax And ten = "C" Then cMax = nTmp
If nTmp < cMin And ten = "C" Then cMin = nTmp
vt1 = vt2
Exit Do
Else
vt2 = vt2 + 1
End If
Loop
Else
vt1 = vt1 + 1
End If
Loop While vt1 < Len(RngChk)
MsgBox "rMin=" & rMin & " rMax=" & rMax & " cMin=" & cMin & " cMax=" & cMax
End Sub