MsgBox ActiveCell.Address(True,False,xlA1,True)
Use the ExternalReference argument of the .Address property.
Code:MsgBox ActiveCell.Address(True,False,xlA1,True)
Function MyUDF(rng As Range) As String
Application.Volatile
If UBound(Split(rng.Parent.Name, " ")) > 0 Then
MyUDF = "'" & rng.Parent.Name & "'!" & rng.Address(False, False, xlA1)
Else
MyUDF = rng.Parent.Name & "!" & rng.Address(False, False, xlA1)
End If
End Function
If you already have a range object, why do you want to use its address to refer to it in a udf?
Function MyUDF(r As Range)
MsgBox Evaluate("Sum(" & r.Address & ")")
End Function
If you already have a range object, why do you want to use its address to refer to it in a udf?
Code:Function MyUDF(r As Range) MsgBox r.worksheet.Evaluate("Sum(" & r.Address & ")") End Function
For example.