Runtime error '1004' while creating a pivot table
问题 I am trying to create a pivot table after copying the data from one workbook to another workbook. Here is the code. Dim ws As Worksheet Set ws = Sheets.Add ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _ "PIVOT_RANGE", Version:=xlPivotTableVersion14). _ CreatePivotTable TableDestination:=ws.Name & "!R1C1", TableName:= _ "PivotTable2", DefaultVersion:=xlPivotTableVersion14 I am seeing different pivot table name every time. Sometimes it shows PivotTable1 and Sometimes