Detecting "CallingCell" In Function

D

dec_obrien

Hi,
I have a custom function that calculates the Date given various
conditions. What I want to do is conditionally format the cell from
where the function is called based on the day of the week calculated.
It's like "ActiveCell" for the calling cell of the function but
obviously ActiveCell will not be correct. I know I could pass the Cell
Row/ Column in as arguments to teh function but this seems a bit messy
if there an easier way of detecting this.

Any ideas?
 
N

NickHK

A UDF cannot alter the environment, it can only return a value.
So you can't format a cell with a call from a worksheet function.

Maybe you should Format >Conditional Formatting...

NickHK
 
B

Bob Phillips

You cannot format a cell from within a UDF, just no can do.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
G

Guest

Function who_called_me()
who_called_me = ""
MsgBox (Application.Caller.Address)
End Function
 
D

dec_obrien

Thanks guys, Application.Caller.Address gets teh address of the cell but
it won't change the format of the cell.
 

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

Top