louperrotta
New Member
- Joined
- Jul 30, 2024
- Messages
- 20
- Office Version
- 365
- Platform
- Windows
I want to create a Bi-directional (two-way) Link in Excel that can link multiple rows and columns!
First off, thank you to StephenCrump for the VBA for bi-directional linking multiple cells in a column! Awesome!
Again, I'm very much a layman, I got help from StephenCrump on the VBA code for one column which was -
'In Sheet1 module
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A1:A20")) Is Nothing Then
Application.EnableEvents = False
Sheets("Sheet2").Range("B1:B20").Value = Range("A1:A20").Value
Application.EnableEvents = True
End If
End Sub
'In Sheet2 module
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("B1:B20")) Is Nothing Then
Application.EnableEvents = False
Sheets("Sheet1").Range("A1:A20").Value = Range("B1:B20").Value
Application.EnableEvents = True
End If
End Sub
BUT... to make it harder haha, I wanted to bi-directionally connect/link, say Sheet1 - (A1:A100, B1:B100, etc.) with Sheet2 (A1:A100, B1:B100, etc.) and vice versa .... so I tried -
Sheet1
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A1:A20,B1:B20")) Is Nothing Then
Application.EnableEvents = False
Sheets("Sheet2").Range("A1:A20,B1:B20").Value = Range("A1:A20,B1:B20").Value
Application.EnableEvents = True
End If
End Sub
Sheet2
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("B1:B20,A1:A20")) Is Nothing Then
Application.EnableEvents = False
Sheets("Sheet1").Range("B1:B20,A1:A20").Value = Range("B1:B20,A1:A20").Value
Application.EnableEvents = True
End If
End Sub
And...I can't get the code to work, I obviously must be doing something wrong, what do you all think? I appreciate you all and thank you in advance!!! You all are amazing!
First off, thank you to StephenCrump for the VBA for bi-directional linking multiple cells in a column! Awesome!
Again, I'm very much a layman, I got help from StephenCrump on the VBA code for one column which was -
'In Sheet1 module
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A1:A20")) Is Nothing Then
Application.EnableEvents = False
Sheets("Sheet2").Range("B1:B20").Value = Range("A1:A20").Value
Application.EnableEvents = True
End If
End Sub
'In Sheet2 module
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("B1:B20")) Is Nothing Then
Application.EnableEvents = False
Sheets("Sheet1").Range("A1:A20").Value = Range("B1:B20").Value
Application.EnableEvents = True
End If
End Sub
BUT... to make it harder haha, I wanted to bi-directionally connect/link, say Sheet1 - (A1:A100, B1:B100, etc.) with Sheet2 (A1:A100, B1:B100, etc.) and vice versa .... so I tried -
Sheet1
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A1:A20,B1:B20")) Is Nothing Then
Application.EnableEvents = False
Sheets("Sheet2").Range("A1:A20,B1:B20").Value = Range("A1:A20,B1:B20").Value
Application.EnableEvents = True
End If
End Sub
Sheet2
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("B1:B20,A1:A20")) Is Nothing Then
Application.EnableEvents = False
Sheets("Sheet1").Range("B1:B20,A1:A20").Value = Range("B1:B20,A1:A20").Value
Application.EnableEvents = True
End If
End Sub
And...I can't get the code to work, I obviously must be doing something wrong, what do you all think? I appreciate you all and thank you in advance!!! You all are amazing!