ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need to identify the start and end of range (https://www.excelbanter.com/excel-programming/288089-need-identify-start-end-range.html)

Neil Bhandar[_2_]

Need to identify the start and end of range
 
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

Jim Rech

Need to identify the start and end of range
 
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


--
Jim Rech
Excel MVP




All times are GMT +1. The time now is 04:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com