Need to identify the start and end of range

  • Thread starter Thread starter Neil Bhandar
  • Start date Start date
N

Neil Bhandar

Hello:

I have a RefEdit field with the range 'TaxData'!
$B$4:$G$18', I need to figure out the StartRow, StartCol,
EndRow, EndCol reference.

e.g. $B$4 = Row 4, Col 2
$G$18 = Row 18, 7

is there a VBA function that could return the Row/Col
values directly or if some one can point me to a piece of
code I can reuse.

Thanks in advance,
-Neil
 
Sub a()
Dim Rg As Range
Dim StringRg As String
StringRg = "TaxData!$B$4:$G$18"
Set Rg = Range(StringRg)
Debug.Print "Start row: "; Rg.Row
Debug.Print "Start col: "; Rg.Column
Debug.Print "End row: "; Rg.Row + Rg.Rows.Count - 1
Debug.Print "End col: "; Rg.Column + Rg.Columns.Count - 1
End Sub
 
Back
Top