While I'm a vba newbie, I try (and I hope I'm posting in the right place)...
I'm trying to mirror a range of cells on Sheet1 to Sheet 2. I found the following code elsewhere in the forums (credit to davesexcel):
Private Sub Worksheet_Change(ByVal Target As Range)
If Union(Range("$F$13:$F$16"), Target).Address = Range("$F$13:$F$16").Address Then
Target.Offset(0, 4) = Target
End If
If Union(Range("$J$13:$J$16"), Target).Address = Range("$J$13:$J$16").Address Then
Target.Offset(0, -4) = Target
End If
End Sub
OK - so I modified it to this:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myRange As Range
Dim myRange2 As Range
Set myRange = Worksheets("Sheet1").Range("$F$13:$F$16")
Set myRanges = Worksheets("Sheet2").Range("$J$13:$J$16")
If Union(myRange, Target).Address = myRange.Address Then
Target.Offset(0, 4) = Target
End If
55 If Union(myRanges, Target).Address = myRanges.Address Then
Target.Offset(0, -4) = Target
End If
End Sub
Yes, I probably mangled it badly as I don't exactly understand the statement. I'm hoping someone could post something that does work and I can compare/understand...? it does work if I change Sheets2 to Sheets1...
Bookmarks