Linking Two Cells Together (complex)

%3CLINGO-SUB%20id%3D%22lingo-sub-2176615%22%20slang%3D%22en-US%22%3ELinking%20Two%20Cells%20Together%20(complex)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2176615%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3EDoes%20anyone%20know%20if%20one%20could%20equate%20two%20cells%20in%20Excel%2C%20say%20A1%20and%20C1%2C%20such%20that%20if%20I%20change%20A1%2C%20then%20C1%20will%20change%20to%20reflect%20the%20data%20of%20A1%2C%20%3C%2FSPAN%3E%3CSTRONG%3Eand%20%3C%2FSTRONG%3E%3CSPAN%3Eif%20I%20change%20C1%2C%20A1%20will%20reflect%20the%20data%20of%20C1%3F%20I%20don't%20believe%20formulas%20will%20permit%20this%20since%20when%20you%20enter%20data%20into%20a%20cell%2C%20it%20removes%20the%20formula.%20But%20perhaps%20Excel%20has%20another%20tool%20for%20this%3F%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2176615%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Visitor

Does anyone know if one could equate two cells in Excel, say A1 and C1, such that if I change A1, then C1 will change to reflect the data of A1, and if I change C1, A1 will reflect the data of C1? I don't believe formulas will permit this since when you enter data into a cell, it removes the formula. But perhaps Excel has another tool for this? 

1 Reply

@waldhari1365 

 

You will need vba for that. If you right click on your worksheet tab, select 'view code', and then paste this into the code module that appears. Then close the vba window.

 

Private Sub Worksheet_Change(ByVal Target As Range)
     Dim myRange As Range: Set myRange = Union(Me.Range("A1"), Me.Range("C1"))

     If Not Intersect(Target, myRange) Is Nothing Then
          Application.EnableEvents = False
          myRange.Value = Target.Value
          Application.EnableEvents = True
     End If

End Sub