'Pivot table is not populating data and stops at a certain month
I have a pivot table that pulls the month and storage location but when I add April data and run the macro it does not populate in the pivot table.
It's pulling data in the columns ($A:$AA)
but it's not picking up that certain month which is weird.
I went into the pivot table filter and april is selected but it's just not pulling the data from the template tab.
I attached the VBA below and also a pic of the pivot 
' RunData Macro
'
'
Columns("A:L").Select
Application.CutCopyMode = False
ActiveWorkbook.Worksheets("Template").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Template").Sort.SortFields.Add Key:=Range( _
"B2:B9435"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
ActiveWorkbook.Worksheets("Template").Sort.SortFields.Add Key:=Range( _
"K2:K9435"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
ActiveWorkbook.Worksheets("Template").Sort.SortFields.Add Key:=Range( _
"E2:E9435"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
ActiveWorkbook.Worksheets("Template").Sort.SortFields.Add Key:=Range( _
"F2:F9435"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
ActiveWorkbook.Worksheets("Template").Sort.SortFields.Add Key:=Range( _
"D2:D9435"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Template").Sort
.SetRange Range("A1:L9435")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Sheets("Formulas").Select
Range("M2:Z2").Select
Selection.Copy
Sheets("Template").Select
Range("M2").Select
ActiveSheet.Paste
Range("M2:Z2").Select
Selection.AutoFill Destination:=Range("M2:Z100000")
Range("M2:Z100000").Select
Columns("M:Z").Select
Selection.Copy
Columns("M:M").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.ScrollColumn = 7
ActiveWindow.ScrollColumn = 6
ActiveWindow.ScrollColumn = 5
ActiveWindow.ScrollColumn = 4
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Range("A1").Select
Application.CutCopyMode = False
ActiveWorkbook.RefreshAll
ActiveWorkbook.Save
End Sub
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
