View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Jim Thomlinson Jim Thomlinson is offline
external usenet poster
 
Posts: 5,939
Default VBA Created Worksheet Function Not Recalculating

Post the function. There are a couple of ways to make it calculate. it
depends on the nature of the function which will be best.

1. you can add application.volatile to the start of the function. that makes
the function volatile similar to the now() function. The good new is that it
will always recaclualte. Teh bad new is that it recalc every time a calc runs
adding a lot of overhead.

2. Add a cell reference to as an argument to the function. If the ceel
referenced in the argument changes then the formula is dirtied and will recalc

public function SumStuff(byval MyCell as range) as double
SumStuff = MyCell + MyCell.Parent.Range("A1").value
end function

The function above would be used in a cell like =SumStuff(B1). It Adds B1 to
A1. If B1 changes then the formula will recalc. If A1 is changed then the
formula will not recalc as A1 is not one of the arguments being passed in.
--
HTH...

Jim Thomlinson


"Falcon Feet" wrote:

I created my own Excel worksheet function in VBA. The function (formula)
works correctly when entered in a cell, but it does not recalculate when the
cell that the formula references changes. FYI, the workbook's "Calculation"
option IS set to Automatic.