Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello;
Below is a brief description of the problem and the code: There's a starting value in Each of the UNLOCKED cells C12, C14, C16. The purpose of the w/s Change event is (3 scenarios for now): ....If the value in cell C12 is changed manually, cell C16 is automatically calculated ....If the value in cell C14 is changed manually, cell C16 is automatically calculated ....If the value in cell C16 is changed manually, cell C14 is automatically calculated The manually changed values are displayed in dark yellow fill. ==================================== Private Sub Worksheet_Change(ByVal Target As Range) Const sInputCells = "C12,C14,C16" ' manually input ANY 2 of C12, C14, C16 values and the 3rd is automatically calculated ' and displayed in light green fill With Target If Not Intersect(.Cells, Range(sInputCells)) Is Nothing Then If .Column = 3 Then On Error GoTo ErrHandler Application.EnableEvents = False If .Row = 12 Then 'calc C16 .Interior.ColorIndex = 6 .Offset(2, 0).Interior.ColorIndex = 6 .Offset(4, 0).Interior.ColorIndex = 35 .Offset(4, 0).Formula = "=E12*C19*60/C9/C14" ElseIf .Row = 14 Then 'calc C16 .Interior.ColorIndex = 6 .Offset(-2, 0).Interior.ColorIndex = 6 .Offset(2, 0).Interior.ColorIndex = 35 .Offset(2, 0).Formula = "=E12*C19*60/C9/C14" ElseIf .Row = 16 Then 'calc C14 .Interior.ColorIndex = 6 .Offset(-4, 0).Interior.ColorIndex = 6 .Offset(-2, 0).Interior.ColorIndex = 35 .Offset(-2, 0).Formula = "=E12*C19*60/C9/C16" End If End If End If End With ErrHandler: Application.EnableEvents = True End Sub ==================================== With unprotected sheet and only the above w/s Change event in effect ( XL 2003 Options: 1,000 Iterations, Max. change 0.00001, though not really needed!): 1) procedure works fine by manually changing the values in C14 and/or C16 2) procedure works fine by manually changing the value in C12 provided the preceding manual change(s) was in C14 3) procedure FAILS when manually changing the value in C12 if the preceding manual change(s) was in C16. So it seems to me that the problem (circular ref., 0.00 or DIV/0!) is most certainly with the above Change event code. I would be glad to attach the simple test w/b (single w/s), if I only know how !! Your help in identifying the problem would be greatly appreciated. Thank you kindly. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
I need to figure out how to get this =(DAY(TODAY())*2) to stop calcul. at end of mnth | Excel Discussion (Misc queries) | |||
My sumif formulas containin links to other workbooks do not calcul | Excel Worksheet Functions | |||
Excel n'actualise pas le calcul des fonctions quand je modifie le. | Excel Worksheet Functions | |||
Max of integer vals | Excel Programming | |||
Max of integer vals | Excel Programming |