LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 215
Default Changing up to 2 of 3 vals and the 3rd val is automatically Calcul

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I need to figure out how to get this =(DAY(TODAY())*2) to stop calcul. at end of mnth Renz09 Excel Discussion (Misc queries) 1 May 3rd 06 10:22 AM
My sumif formulas containin links to other workbooks do not calcul sgm_wfa Excel Worksheet Functions 4 February 12th 06 09:31 AM
Excel n'actualise pas le calcul des fonctions quand je modifie le. juyen Excel Worksheet Functions 1 March 24th 05 06:56 PM
Max of integer vals jbl25[_2_] Excel Programming 0 September 30th 04 03:03 PM
Max of integer vals jbl25 Excel Programming 3 September 30th 04 02:19 AM


All times are GMT +1. The time now is 05:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"