Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 136,459 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,823 people online right now. Registration is fast and FREE... Join Now!




PivotTable refresh code gives run-time error '1004'

 
Reply to this topicStart new topic

PivotTable refresh code gives run-time error '1004'

Dabbler
29 Jul, 2008 - 12:28 PM
Post #1

New D.I.C Head
*

Joined: 28 Jul, 2008
Posts: 2

Hi,

I am using this code - ActiveSheet.PivotTables("PivotTable2").PivotCache.Refresh in an attempt to refresh a pivot based off an external data source in Excel but every time I run it I get a Run-time error '1004': Application-defined or object-defined error.

I tried simply recording a macro but when I do the macro looks like this

Sub Macro8()
'
' Macro8 Macro
'

'
Sheets("pivot").Select
Range("B6").Select
End Sub

I think it's because the pivot is based off an external query. What I am trying to do is to have an update pivot macro attached to a button that updates the pivot once the data has been updated which is tied to a parameter query.

I have googled this to death and cannot find an answer.

Thanks for any suggestions.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 03:57PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month