References in VBA

  • Thread starter Thread starter Floyd
  • Start date Start date
F

Floyd

If I have a function such as TestFxn(A1, A3), how do I get the exact
reference and not the cell value into the function?

Function TextFxn(A1, A3)
Debug.Print A1
End Function

Immediate Window:
A1 or "A1" of "$A$1" etc

Thanks in advance.
 
Floyd said:
If I have a function such as TestFxn(A1, A3), how do I get the exact
reference and not the cell value into the function?

Function TextFxn(A1, A3)
Debug.Print A1
End Function

Immediate Window:
A1 or "A1" of "$A$1" etc

Thanks in advance.

One way is to pass the parameters as Range rather than String, long or
whatever. So if TextFxn is declared like this
Public TextFxn(r1 As Range, r2 As Range) As long
you get the reference from r1.Address

/Fredrik
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top