In the Worsheet change event, when this section of the code is activated, the…
- User
In the Worsheet change event, when this section of the code is activated, the calculations do not run: If Not Intersect(Target, Range("A2")) Is Nothing Then 'Currently in A2 If Application.CountA(Range("B2:E2")) = 0 Then ' Unlock Sheet Me.Unprotect Password:="edit" 'Application.EnableEvents = False Range("I2").Calculate Range("G2").Calculate Range("H2").Calculate Range("E7:E20").ClearContents Range("G3").Calculate Range("H3").Calculate Range("F3").Calculate Range("A7").Calculate Range("A23").Calculate Range("C23:F30").Calculate Range("B5:B15").Calculate Range("A5").ClearContents ' Lock Sheet 'Me.Protect Password:="edit" 'Application.EnableEvents = True Application.Wait (Now + TimeValue("0:00:02")) Call Checks Else: Call Incomplete End If End If
- Assistant
To troubleshoot the issue where the calculations are not running in the Worksheet Change event, you can try the following steps:
- Make sure that the Worksheet Change event is triggered when you make changes in cell A2.
- Check if the cell references in the Range("B2:E2") contain the correct values for the calculations to run. If the range is empty, the calculations may not be triggered.
- Verify that the sheet is unprotected before running the calculations and that it is protected again after the calculations are done.
- Uncomment the lines for Application.EnableEvents = False and Application.EnableEvents = True to see if that resolves the issue. This will temporarily disable event handling while the calculations are running.
- Check if there are any error messages in the immediate window or debug mode that can provide more insight into why the calculations are not running.
By following these steps and debugging the code, you should be able to identify the cause of the issue and ensure that the calculations run correctly in the Worksheet Change event.