Automatic update

  • Thread starter Thread starter Jakob
  • Start date Start date
J

Jakob

Hello

I want to update a pivot table when a cell is changed.

Sub Oppdater()
' Oppdate Makro
' Oppdate pivot
'
Private Sub date_Change()
' Oppdate if change

Range("B8").Select
ActiveSheet.PivotTables("Pivottabell1").PivotCache.Refresh
End Sub
 
Select the sheet tab which you want to work with. Right click the sheet tab
and click on 'View Code'. This will launch VBE. Paste the below code to the
right blank portion. Get back to to workbook and try out.

Check out the date cell in the below code it is B8
Check out the name of the table "PivotTable1" and adjust to suit

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Not Application.Intersect(Target, Range("B8")) Is Nothing Then
ActiveSheet.PivotTables("PivotTable1").PivotCache.Refresh
Application.EnableEvents = True
End Sub

If this post helps click Yes
 
right click the sheet tab and select 'View Code' and then paste the following
code. It uses the sheet's CHANGE event to trap when an entry has been made.
If the cell changed is the one you want, then the pt is refreshed...


Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("B9").Address Then
Worksheets("Sheet1").PivotTables(1).PivotCache.Refresh
End If

End Sub
 
Back
Top