Hi,
I have the following situation:
1) A UDF located on A3 (e.g) is dependent on the value of a cell (e.g. A1) set through a validation list
2) A1 is "watched" with Worksheets_change so that A2 can be updated when A1 change.
3) Application.Calculation is set to xlCalculation manual at workbook.open
With the erratic behaviour:
1) when A1 is changed, Worksheets_change is executed correctly, which changes both A2 and A3
2) the second time, it starts well, but the updating of A2 triggers the UDF which then does not allow to get back to the Worksheets_change function to finish the code.
Can anyone look at the example supplied and try to help me understand what's going wrong in this example and in the problem below?
In my actual file (the attached on is just a simple example), I cannot set the Application.Calculation to xlCalculationManual from within the Worksheets_change when it is triggered by a change in a cell that has a UDF as a dependency: When the Worksheets_change is triggered by the user changing that cell, the Application.CalculationState is in pending mode because the cell has the UDF as a dependency, which then seems to make Application.Calculation as a read-only.
This will result in the UDF being triggered from the Worksheets_change as the Application.Calculation is in automatic. The program won't return to the Worksheets_change to execute the remaining lines of code.
My eternal gratitude and admiration will go to the person coming up with an explanation of the UDF's behaviour and a way to control it.
Cheers
Bookmarks