Hello Everyone,
I am new to the Forum. Plz guide me.I have recorded a Macros whcih will create a Pivot charts and Pivot Table. It works fine for 1st time, Next time when I run it, it throws an error. To make it works , I need to delete the existing pivot charts and tables to run it smoothly.Below is the Code where I am getting an error. What I need is it should check if pivot charts/ tables exist, if it finds it it should replace it with the new one with sheet name as "Open". Plz help on this. I tried a lot.
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Atos Open", Version:=xlPivotTableVersion14).CreatePivotTable _
TableDestination:="Sheet2", TableName:="PivotTable4", _
DefaultVersion:=xlPivotTableVersion14
I am new to the Forum. Plz guide me.I have recorded a Macros whcih will create a Pivot charts and Pivot Table. It works fine for 1st time, Next time when I run it, it throws an error. To make it works , I need to delete the existing pivot charts and tables to run it smoothly.Below is the Code where I am getting an error. What I need is it should check if pivot charts/ tables exist, if it finds it it should replace it with the new one with sheet name as "Open". Plz help on this. I tried a lot.
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Atos Open", Version:=xlPivotTableVersion14).CreatePivotTable _
TableDestination:="Sheet2", TableName:="PivotTable4", _
DefaultVersion:=xlPivotTableVersion14