Excel VB Pivot Table Auto Refresh - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Excel VB Pivot Table Auto Refresh

DuncanSkiltonDuncanSkilton UKPosts: 0Member

Hiya. I'm having a bit of trouble with an auto update. I have found the following code but don't quite understand how to incorperate it into my excel spreadsheet.

'Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A1").CurrentRegion) Is Nothing Then Exit Sub
Me.PivotTables(1).RefreshTable
End Sub'

These are the macro's used to manually update when a button is pressed

Sub Macro2()
Range("G6").Select
ActiveSheet.PivotTables("PivotTable2").PivotCache.Refresh
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Removed Date")
.PivotItems("31/01/2013").Visible = False
End With
End Sub

Sub UPD()
' UPD Macro
Sheets("To Let Boards").Select
ActiveWindow.SmallScroll Down:=-60
Range("B6").Select
ActiveSheet.PivotTables("PivotTable7").PivotCache.Refresh
Range("B5").Select
Selection.Sort Order1:=xlAscending, Type:=xlSortLabels, OrderCustom:=1, _
Orientation:=xlTopToBottom
Sheets("Boards").Select
Range("A2").Select
End Sub

Sub DKW()
' DKW Macro
Sheets("To Let Boards").Select
Range("B6").Select
ActiveSheet.PivotTables("PivotTable7").PivotCache.Refresh
Range("B5").Select
Selection.Sort Order1:=xlAscending, Type:=xlSortLabels, OrderCustom:=1, _
Orientation:=xlTopToBottom
Sheets("Let Agreed").Select
Range("B5").Select
Selection.Sort Order1:=xlAscending, Type:=xlSortLabels, OrderCustom:=1, _
Orientation:=xlTopToBottom
Sheets("Boards Removed").Select
Range("A5").Select
Selection.Sort Order1:=xlAscending, Type:=xlSortLabels, OrderCustom:=1, _
Orientation:=xlTopToBottom
Sheets("Boards").Select
End Sub

Your help is appreciated

Sign In or Register to comment.