Hello All,

I have 2 functions in my excel VBA.

1. Sub InsertPivotTable() - This function is creating pivot table in a new worksheet. Sheet B

2. Sub Copy_Pivot() - This function is copying pivot table from new sheet B to existing Sheet A.

Both the functions are working fine separately. But I have 2 macros for this.

Is there a way I can call Copy_Pivot() in the InsertPivotTable() function.

I added 'Copy_Pivot' towards the end. But this is not working and adding the function is not creating pivot table even.

Can any one please let me know what is missing here.


Sub InsertJEPivotTable()

code
ActiveSheet.PivotTables("SalesPivotTable").PivotFields("DR Amount").Subtotals = Array( _
        False, False, False, False, False, False, False, False, False, False, False, False)
        
Copy_Pivot

End Sub