Marcus131975
New Member
- Joined
- Feb 9, 2018
- Messages
- 14
Hi
I am using the following to delete a pivot table in the active sheet (before recreating it later) but want to skip this function if no pivot table exists, which is possible in some scenarios. I assume I can use some kind of If/Else statement to achieve this, but havent managed to get the Syntax right.
The worksheet will only ever have one PVT if that is any help?
Any help would be appreciated - thank you
Marcus
I am using the following to delete a pivot table in the active sheet (before recreating it later) but want to skip this function if no pivot table exists, which is possible in some scenarios. I assume I can use some kind of If/Else statement to achieve this, but havent managed to get the Syntax right.
VBA Code:
ActiveSheet.PivotTables("PivotTable1").TableRange2.Clear
The worksheet will only ever have one PVT if that is any help?
Any help would be appreciated - thank you
Marcus