Linking 2 cells so that changing either cell changes the other cell

brog20

New Member
Joined
Jun 25, 2013
Messages
1
I have two cells on different worksheets and I want to be able to link one cell to the other so that changing either cell will change the other as well. Or, alternatively, each cell links to a third cell that changes whenever either of the other two cells is changed.

I have no experience with VBA, but I found a thread here that showed me how to link one cell to another by editing the code of the worksheet; however, I can only do this within the same worksheet and have not figured out how to do it for two worksheets.

Here is the code I currently have, which changes cell A3 whenever A1 or A2 change:
Code:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address = "$A$1" Or Target.Address = "$A$2" Then
a = Range("a1")
b = Range("a2")
Application.EnableEvents = False


If Target.Address = "$A$1" Then
Range("a3").Value = a
Else
Range("a3").Value = b
End If
End If
Application.EnableEvents = True
End Sub

I tried setting cell A2 in sheet1 equal to the value in sheet2, then using this code, but changing the value in sheet2 didn't change the value in A3 in sheet1 even though the value in cell A2 changed.

Again, I have no experience or knowledge of VBA so any help/advice/direction to other helpful posts would be greatly appreciated.
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top