Hi all,

Would appreciate some help on this.

I'm not a VBA programmer, but found some snippet of code to make a custom function in a Module. What it does is it queries the web for a value. It works perfectly for me, problem is that now I have a lot of worksheets and many of the functions being called in numerous cells, so when Excel opens it hangs for some time.

What I would like to do is only execute the function when a worksheet is selected. Is this possible? I think that would solve the problem with Excel being unresponsive.

I tried surrounding the custom function with a private sub worksheet_activate() and then an end sub after end function, but it's giving me errors.