Hello all,
I'm trying to copy multiple PivotTables from different worksheets and place one in cell A5 and one in D5... I know my code for the placement portion is not correct, but I don't see why my code for the Copy isn't right.
Any help is greatly appreciated!
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Target, Sheets("PivotTest1").Range("C2")) Is Nothing Then
Application.EnableEvents = False
If StrComp(Target, "Revenue", vbTextCompare) = 0 Then
Sheets("Revenue").PivotTables("PivotTable3").TableRange2.Copy
Sheets("Revenue").PivotTables("PivotTable5").TableRange2.Copy
Else
Sheets("GOP").PivotTables("PivotTable4").TableRange2.Copy
Sheets("GOP").PivotTables("PivotTable6").TableRange2.Copy
End If
With Range("A5,D5")
.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
End With
Target.Select
Application.EnableEvents = True
End If
End Sub
Bookmarks