Have you thought about refreshing the pivot table in a Worksheet_SelectionChange event on the worksheet that contains the pivot table
Main Topics
Browse All TopicsI have a two problems with a pivot table, and in case some one have the aswer for on and not the other I post to different questions.
I would likt it to update itself every time I change the input data. I have a input area where I ad information in to a new row. My Pivot table's input area is big enought, so thats not a problem. The table updates correctly when I use "update field" funtion. But I would lik it to update itself automaticly when I add information.
Edvard Rognlid
Hammerfest, Norway
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Put the code below in the MS Excel Object - ThisWorkbook
I've written it so it only refreshes the pivot table if you have altered a cell that is part of the source data to it.
Make sure to change pvtSource pivot table and worksheet that's assigned to it so it matches yours (at the mo, it refers to the first pivot table and worksheet).
'code:
Private Sub Workbook_SheetChange(ByVal
Dim strSourceData As String
Dim strWorksheet As String
Dim intLength As Integer
Dim pvtSource As PivotTable
'Get address of sourcedata
Set pvtSource = Worksheets(1).PivotTables(
strSourceData = pvtSource.SourceData
intLength = InStr(1, strSourceData, "!")
strWorksheet = Left(strSourceData, intLength - 1)
strSourceData = Mid(strSourceData, intLength + 1)
strSourceData = Application.ConvertFormula
If strWorksheet = Sh.Name Then 'check to see if target range is in the same worksheet as source data
If Union(Range(strSourceData)
pvtSource.RefreshTable
End If
End If
End Sub
Thanks, out of this I´v got a better ide. You see I have the pivot table in another sheet than the input data area, so what I can do is to make a macro that update pivot tabel on entering that sheet.
What should be the name of that macro be?
Private Sub Workbook_SheetEnter(ByVal Sh As Object, ByVal Target As Excel.Range) ??
Edvard
Put this code in the specific sheet with the pivot table under Microsoft Excel Objects found in the VBA window.
Private Sub Worksheet_Activate()
PivotTables(1).RefreshTabl
End Sub
Like Workbook_SheetChange, Worksheet_Activate is an Excel event that runs code when you have performed a specific action (in this instance selecting the worksheet). If you're not familiar with this, in the top right corner of the code window is a combobox with all events listed. Make sure the combobox to the left of that one has Workbook/Worksheet selected (depending on whether it is ThisWorkbook or a sheet).
Business Accounts
Answer for Membership
by: edvardrPosted on 1999-05-23 at 05:13:57ID: 1604314
Edited text of question.