Call a Sub from a Worksheet Function

B

BobbyMurcerFan

In Excel97, I have a VBA sub that I want to run only when a formul
evaluates to a certain value. So I would like to create a function tha
calls the sub only if the value is acheived.

I've tried the calculate event, but the sheet has too many formulas an
calcualtions for this to be at all practical.

I've also tried the change event, but that doesn't work b/c the tes
value is the result of a formula. And that formula is the result o
other formulas that do not get user input--so I can't use the approac
of testing an input cell for a change of value.

Maybe the CALL function would help, but I've never used it and am jus
not sure. I would think there would be a way to construct a functio
that conditionally calls a sub.


THANKS A LOT! :)


P.S. I have some C++ experience if that is in any way helpful t
solving this prob. THANKS AGAI
 
F

Frank Kabel

Hi
the worksheet_calculate event is IMHO you only option. To restrict it I
would first store the initial value of your cell calculation in a
static variable and check each time this procedure is invoked if the
value has changed
 

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