WS1
A B C
7
3
6
3
WS2
D
7
7
3
3
I am trying to write a macro which is triggered on change of any Column A in worksheet1 and change is reflected in values in column D of worksheet 2
e;g A1 = 7 is changed to 8 in worksheet 1
then D1 and D2 should become 8
--------------------
On same woksheet I am able to write it but with columns in two different worksheets I am not able to write.
---------------------------------------------------
Private OldVal As Variant
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
OldVal = Target.Value
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Range("A1:A100")) Is Nothing Then
MsgBox OldVal
MsgBox Target.Value
Set changeRange = Range("D1:D65")
For Each Cell In changeRange
If Cell.Value = OldVal Then
Cell.Value = Target.Value
End If
Next
End If
End Sub
---------------------------------------------------------------
Any help is highly appreciated.
Bookmarks