Pass on cell address to an UDF?
Something like this ?
Function CellTell()
If Application.Caller.Address(False, False) = "C4" Then
CellTell = "Explosive"
Else
CellTell = "Harmless"
End If
End Function
Tim
"Charlotte E" <@ wrote in message
...
AltaEgo wrote:
Using inbuilt functions in cells:
=IF(ADDRESS(ROW(),COLUMN())="$C$4","Explosive Cell","Harmless")
Expand on this and pass some parameters if you need it in a UDF:
Function CELLTELL(addr)
'use this way in cell
' =CELLTELL(ADDRESS(ROW(),COLUMN()))
CELLTELL = "Harmless cell"
If addr = "$C$4" Then CELLTELL = "Explosive cell"
End Function
Thanks, but that's the whole point: I was kind of hoping to be able to
avoid the ADDRESS(ROW(),COLUMN()), and just use =CELLTELL().
I was hoping that VBA had a way of 'reading' what cell the function was
located in?
Actually, just lige =ROW()
Somehow that function must be able to 'read' what cell it is located in?
Anyone know how to do this?
TIA,
"Charlotte E" <@ wrote in message
...
Is it possible to pass on the cell, in which an UDF is located, to
the UDF itself?
Example:
In cell C4, I have an UDF, like:
=CELLTELL()
...and the UDF could return something like:
Function CELLTELL()
If Celladdress = "C4" Then
CELLTELL = "Explosive cell!"
Else
CELLTELL = "Harmless cell"
End If
End Function
Hope you get the picture...
Thanks,
|