ok so I have this macro that works perfectly fine when I'm on this sheet. This is in a sheet that is called "RL". The issue I have is that the cells in the columns 12-19 on sheet "RL" are a result of a lookup from a pivot table. So they are formulas. So when the pivot table (which is a sheet named "Pivot Table" in the same workbook) gets updated this code doesn't actually run because this code only runs when it's the active sheet. So I guess the question is how can I have sheet "RL" run this code when a different sheet is the active sheet.
Thanks in advance
excel 2016
Code:
Dim WasValue
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 12 Then Cells(Target.Row, 21).Value = WasValue
If Target.Column = 13 Then Cells(Target.Row, 22).Value = WasValue
If Target.Column = 14 Then Cells(Target.Row, 23).Value = WasValue
If Target.Column = 15 Then Cells(Target.Row, 24).Value = WasValue
If Target.Column = 16 Then Cells(Target.Row, 25).Value = WasValue
If Target.Column = 17 Then Cells(Target.Row, 26).Value = WasValue
If Target.Column = 18 Then Cells(Target.Row, 27).Value = WasValue
If Target.Column = 19 Then Cells(Target.Row, 28).Value = WasValue
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 12 Then WasValue = Target.Value
If Target.Column = 13 Then WasValue = Target.Value
If Target.Column = 14 Then WasValue = Target.Value
If Target.Column = 15 Then WasValue = Target.Value
If Target.Column = 16 Then WasValue = Target.Value
If Target.Column = 17 Then WasValue = Target.Value
If Target.Column = 18 Then WasValue = Target.Value
If Target.Column = 19 Then WasValue = Target.Value
End Sub
excel 2016