Results 1 to 1 of 1

UDF and Worksheet_change - unexplainable behaviour linked to xlCalculationManual

Threaded View

  1. #1
    Registered User
    Join Date
    01-27-2009
    Location
    London,England
    MS-Off Ver
    Excel 2007
    Posts
    1

    Angry UDF and Worksheet_change - unexplainable behaviour linked to xlCalculationManual

    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
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1