Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default automating external linked pivot table

I have a pivot table that is linked to an access query for the data. I'm
attempting to get a macro that will refresh the data after some data in the
excel sheet is changed. The change is linked into a table in ms access and
the query uses that table to calculate. If I just hit refresh on the pivot
table, it works fine, but I can't seem to get a macro to work - i'm very new
to vba programming.
--
smiller600
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,979
Default automating external linked pivot table

You can use event code to refresh the pivot table. For example,
right-click on the sheet tab of the sheet where you'll make the change,
and choose View Code.
Where the cursor is flashing, paste in this code:

Private Sub Worksheet_Change(ByVal Target As Range)
Worksheets("Pivot").PivotTables(1).PivotCache.Refr esh
End Sub

Change the sheet name to the pivot table sheet name in your workbook.
If you want the pivot table to refresh only when a specific cell is
changed, you could test for that in the code. For example:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$H$2" Then
Worksheets("Pivot").PivotTables(1).PivotCache.Refr esh
End If
End Sub


smiller600 wrote:
I have a pivot table that is linked to an access query for the data. I'm
attempting to get a macro that will refresh the data after some data in the
excel sheet is changed. The change is linked into a table in ms access and
the query uses that table to calculate. If I just hit refresh on the pivot
table, it works fine, but I can't seem to get a macro to work - i'm very new
to vba programming.



--
Debra Dalgleish
Contextures
http://www.contextures.com/tiptech.html

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default automating external linked pivot table

Will this work for the pivot cache coming in from an access query? I need
the query to update the data for the pivot table - When I've tried the below
type of code, I get the following run time error (1004) [Microsoft][ODBC
Microsoft Access Driver]Connection for viewing your linked microsoft excel
worksheet was lost.

When choose tools/references in visual basic - I get a error access system
registery.

I'm starting to link there is something wrong inside my microsoft not being
able to access something it needs.

--
smiller600


"Debra Dalgleish" wrote:

You can use event code to refresh the pivot table. For example,
right-click on the sheet tab of the sheet where you'll make the change,
and choose View Code.
Where the cursor is flashing, paste in this code:

Private Sub Worksheet_Change(ByVal Target As Range)
Worksheets("Pivot").PivotTables(1).PivotCache.Refr esh
End Sub

Change the sheet name to the pivot table sheet name in your workbook.
If you want the pivot table to refresh only when a specific cell is
changed, you could test for that in the code. For example:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$H$2" Then
Worksheets("Pivot").PivotTables(1).PivotCache.Refr esh
End If
End Sub


smiller600 wrote:
I have a pivot table that is linked to an access query for the data. I'm
attempting to get a macro that will refresh the data after some data in the
excel sheet is changed. The change is linked into a table in ms access and
the query uses that table to calculate. If I just hit refresh on the pivot
table, it works fine, but I can't seem to get a macro to work - i'm very new
to vba programming.



--
Debra Dalgleish
Contextures
http://www.contextures.com/tiptech.html


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pivot table keeps dupping to another linked pivot table Angus Excel Discussion (Misc queries) 0 August 8th 05 07:48 AM
Working With Pivot Table And External DB Frank Excel Discussion (Misc queries) 0 June 14th 05 08:32 AM
automating get external data (from web) _Bigred Excel Worksheet Functions 0 June 12th 05 10:25 PM
Pivot table using External data nc Excel Discussion (Misc queries) 3 April 26th 05 12:54 PM
automating a pivot table bobf Excel Discussion (Misc queries) 1 January 21st 05 09:58 PM


All times are GMT +1. The time now is 02:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"