Cell updates not occuring
mark_the_yeti wrote:
I have many cells using a formula I created in VBA (below).
When the workbook opens it asks me to allow macro, and I do. Then it asks
if I want to update, and I do. The cells remain un-updated, however, until I
double-click on them as if to edit, then hit enter. Only then does any one
cell update.
I have made sure the File-Options-Calculate-Autocalculate option has been
selected.
F9 has no effect.
Note that the worksheet "Mark P" is hidden in this workbook, and the values
in Mark P are coming from a worksheet in a different workbook. I have
confirmed that this part is working properly, though.
You help is seincerely appreciated.
Function MarkP(task, start, fin)
hours = 0
For Row = start To fin
Set curCell = Worksheets("Mark P").Cells(Row, 4)
Set valCell = Worksheets("Mark P").Cells(Row, 5)
If curCell.Value = task Then
hours = hours + valCell.Value
End If
Next Row
MarkP = hours
End Function
Excel calls udf function when parameters to that function change values.
As long as task, start and fin do not change excel does not see any
reason to call that function and update its value.
Excel does not consider changes in Worksheets("Mark P").Cells(Row, 4)
range as a reason to call the function because this range is not a
parameter to that function
Instead of having task, start and fin pass task and a range as
parameters and use start and fin in excel formula to build range which
should be passed to your function.
|