How to Code

May 31, 2013 at 7:14 AM
How can I translate to VB.Net?

Function Test(Target As Object) As String
Dim temp_Row_No As Integer
Dim temp_Col_No As Integer
Dim temp_ANS As String

temp_Row_No = Target.Row
temp_Col_No = Target.Column

temp_ANS = temp_Row_No & "," & temp_Col_No
End Function
Coordinator
May 31, 2013 at 10:31 AM
Jun 6, 2013 at 8:27 AM
Thanks a lot !
I'll try.
Jun 7, 2013 at 10:34 AM
I tried to code using sample above.
I could to get cell-address like "A1".
But I could not get row no. or column no.
I want to get row no or column no. direct.
Coordinator
Jun 7, 2013 at 11:35 PM
Hi,

If you just want the row and column of a reference passed to your function, you might try this:
Public Module MyFunctions

Public Function GetReferenceInfo( <ExcelArgument(AllowReference:=True)> theReference as Object) As String
    If TypeOf(theReference) Is ExcelReference Then
        Return "Row: " & theReference.RowFirst+1 & " Column: " & theReference.ColumnFirst+1
    Else
        Return "Not a Reference"
    End If
End Function

End Module
And then call it as =GetReferenceInfo(D3).
Note that the RowFirst / ColumnFirst values in the ExcelReference are 0-based, which is why I'm adding 1 in each case.

-Govert
Jun 8, 2013 at 8:09 AM
Thank you,Govert.
Your information is very good for me.