Pivot Error showing but on a different macro Sheet. Not on the sheet the where I refreshed

Devonair

New Member
Joined
Apr 17, 2019
Messages
26
Hi,

This is my first time. I have been looking everywhere for a solution for this
I have made a pivot table on Sheet4 and named the Pivot table to Overtime.
But when I refresh manually by right click the newly made pivot table stops and shows an error

------------------
Run-time Error '1004':

Unable to get the PivotTables property of the Worksheet Class
------------------

When I click Debug the error goes to my sheet3 Not in sheet4 and points to this different Pivot table I made previously

Sub RefreshCustomPivotTable2()
Application.DisplayAlerts = False
With ActiveSheet
.PivotTables("WBS_Pivot").RefreshTable <- this one has the error pointed at
End With
End Sub

Its not the pivot table I refreshed, and not even at the same sheet.

Can anybody help me on this issue. I am using Excel 2013 by the way.

Lots of thanks guys
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Maybe change this

Code:
With ActiveSheet


to

Code:
With Sheets("Sheet4")
 
Upvote 0
Additional info.

I noticed when I go to my Sheet3 after the error the pivot table there WBS_Pivot is selected and highlighted like its being copied.
 
Upvote 0
OK, maybe this way then....

Code:
Sub RefreshCustomPivotTable2()
Application.DisplayAlerts = False
Sheets("Sheet4").Activate
ActiveSheet.PivotTables("WBS_Pivot").RefreshTable
End Sub
 
Upvote 0
OK, maybe this way then....

Code:
Sub RefreshCustomPivotTable2()
Application.DisplayAlerts = False
Sheets("Sheet4").Activate
ActiveSheet.PivotTables("WBS_Pivot").RefreshTable
End Sub



After doing your code + all my range function I put Sheets("Report 02") it didn't show any error. but the odd thing happened
Is that my active sheet went from sheet4(Overtime) to sheet3(Report 02) its like it auto selected it self to another sheet.
 
Upvote 0
Sorry, I don't understand......
After doing your code + all my range function
Do you have any Worksheet_Change events running...OR...any other code ??
 
Upvote 0
Sorry, I don't understand......

Do you have any Worksheet_Change events running...OR...any other code ??


Sorry for my bad explaination.

Yes I do have Worksheet_Change in every sheet in my workbook except to the new one Sheet4(Overtime) .


after putting all the update edits, When I right mouse click
for a Refresh
Pivot named PivotTable1 from my Sheet4(Overtime). There is no error instead now it will leave Sheet4(Overtime) and go to Sheet3(Report 02) and my pivot table there I named WBS_Pivot ​(before having errors) is somehow selected.

Its a mystery for me.
 
Upvote 0
Hmm makes no sense to me either !
If no steps in with further assistance, I'd suggest uploading to dropbox so we can take a look at it.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top