View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Sam Wilson Sam Wilson is offline
external usenet poster
 
Posts: 523
Default Putting Formula in all cells give Circular Reference. Please help

1. Press Alt + F11 to show the VBE window
2. In the top left pane (Project - VBAProject, find the sheet you're working
on, right-click it and view code
3. In the main window, change (General) to Worksheet and in the box to the
right pick Change. You should see:

Private Sub Worksheet_Change(ByVal Target As Range)

End Sub

In between these two lines, paste the following:


On Error GoTo errorcatcher

Application.EnableEvents = False

If Not Intersect(Target, Columns("A:A")) Is Nothing Then
Target.Offset(0, 1).Formula = "=" & Target.Address(False, False) &
"*52/12"
Target.Offset(0, 2).Formula = "=" & Target.Offset(0, 1).Address(False,
False) & "*12/(52*37)"
End If

If Not Intersect(Target, Columns("B:B")) Is Nothing Then
Target.Offset(0, -1).Formula = "=" & Target.Address(False, False) &
"*12/52"
Target.Offset(0, 1).Formula = "=" & Target.Address(False, False) &
"*12/(52*37)"
End If

If Not Intersect(Target, Columns("C:C")) Is Nothing Then
Target.Offset(0, -1).Formula = "=" & Target.Address(False, False) &
"*(37*52)/12"
Target.Offset(0, -2).Formula = "=" & Target.Offset(0, -1).Address(False,
False) & "*12/52"
End If

errorcatcher:
Application.EnableEvents = True

"K" wrote:

I have figures in cell A1 , B1 & C1 (see below)
A B C€¦col
2.0 8.7 5.4%

in cell A1 I have nothing , in cell B1 I have formula "=A1*52/12" and
in cell C1 again I have formula "=(B1*12)/(37*52)"

As I got formulas in cell B1 & C1 so when ever I put any figure in
cell A1, I get figures automatically appearing in other cells as shown
above if I put 2.0 in cell A1 then I get 8.7 in B1 and 5.4% in C1. I
want to put formula in cell A1 as well and want to chane formulas in
cells B1 and C1 little bit so like this i'll have formulas in all
three cells. I want this because lets say if user put 8.7 in cell B1
then i want 2.0 to automatically appear in cell A1 and 5.4% to in C1.
In other words if user put figure any one of three cells then i want
remaing cells to produce result automatically. I tried putting
formulas in all three cells put i get circular reference error. I
know i can get rid of by ticking box of iterative calculation in
options but then i'll get different results. Is there any way that i
can have formulas in all three cells and if any one of the cells value
get change manually then remaing two show the correct results. and i
want this without having circular reference error. Please can any
friend can help