ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Automatic update (https://www.excelbanter.com/excel-programming/433953-automatic-update.html)

Jakob[_2_]

Automatic update
 
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


--


Jakob
http://www.pointshop.no/austgulen

Jacob Skaria

Automatic update
 
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
---------------
Jacob Skaria


"Jakob" wrote:

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


--


Jakob
http://www.pointshop.no/austgulen


Patrick Molloy[_2_]

Automatic update
 
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.Ref resh
End If

End Sub


"Jakob" wrote:

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


--


Jakob
http://www.pointshop.no/austgulen



All times are GMT +1. The time now is 10:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com