How to keep two cells in a excel in sync by cross linking

S

srinu1264

Hi , I want to keep two cells in sync with the same data. The problem
with the link option is that we can have one source and any target .
But I am interested that same value be shared across two cells so that
if one cell updates the value then the other dependent cell
automatically updates its data.

Please let me know how can I do this?
 
A

Ardus Petus

Cross linking won't work (circular reference), but you could use a
Worksheet_Change event handler.

HTH
 
S

srinu1264

thanks ardus for the reply. But I am new to excel programming.

Could you let me know how can I make that change or include that chang
by an example. I will be very thankful if you can help me regarding thi
as I am stuck and looking ardently for a solution
 
A

Ardus Petus

Are both workbooks simultaneously open?

Are all cell(s) to be synchronized within the same Worksheet in each
Workbook?

TIA
 
A

Ardus Petus

If both cells are in the same Worksheet, the following code should be pasted
in worksheet's code (right-click on tab name and select Code)

I used A1 and A2 as example addresses. You can modify these.

HTH
--
AP

'------
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rCell1 As Range
Dim rCell2 As Range
If Target.Count > 1 Then Exit Sub
Set rCell1 = Range("A1")
Set rCell2 = Range("A2")
Application.EnableEvents = False
Select Case Target.Address
Case rCell1.Address
rCell2.Value = rCell1.Value
Case rCell2.Address
rCell1.Value = rCell2.Value
End Select
Application.EnableEvents = True
End Sub
'-------

"srinu1264" <[email protected]> a écrit
dans le message de [email protected]...
 
Top