ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Retrun row value for $A$12 , return 12 (https://www.excelbanter.com/excel-programming/439377-retrun-row-value-%24%2412-return-12-a.html)

moonhk[_2_]

Retrun row value for $A$12 , return 12
 
Hi All

How to return $A$12 , 12 by Excel rows/address function ?

Current I am using below coding.

Function get_row(loString)
Dim a As String

get_row = Mid(loString, InStr(2, loString, "$") + 1, Len(loString) -
InStr(2, loString, "$"))


End Function

Sub test()
Dim a As String
a = "$A$12"
MsgBox get_row(a)
End Sub

Rick Rothstein

Retrun row value for $A$12 , return 12
 
I would probably use this method myself...

Function get_row(loString)
get_row = Range(loString).Row
End Function

That way, the address being passed into the function can have any
combination of absolute and/or relative address components.

--
Rick (MVP - Excel)


"moonhk" wrote in message
...
Hi All

How to return $A$12 , 12 by Excel rows/address function ?

Current I am using below coding.

Function get_row(loString)
Dim a As String

get_row = Mid(loString, InStr(2, loString, "$") + 1, Len(loString) -
InStr(2, loString, "$"))


End Function

Sub test()
Dim a As String
a = "$A$12"
MsgBox get_row(a)
End Sub




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

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