Hi not sure what I'm doing but I'm trying to help my mom she's using someone's weekly giving software and its giving me ; error 1004 unable to get the pivittables property of the worksheet class.
we've tried to start over multiple times with the same result, i know nothing about code but i know somethings wrong, i see others answers but am not knowledgeable to know how it applies to my situation. any help is appreciated. below is a copy of the section of code getting the error.
we've tried to start over multiple times with the same result, i know nothing about code but i know somethings wrong, i see others answers but am not knowledgeable to know how it applies to my situation. any help is appreciated. below is a copy of the section of code getting the error.
VBA Code:
Sub RefreshPivotTables()
Dim NumRows, RowToPaste, NR_Row, PT_Row As Long
Dim PT As PivotTable
'Refresh Giving Summary Pivot Table
Entry.Activate
Set PT = ActiveSheet.PivotTables("PT_Specials")
PT.RefreshTable
PT_Row = PT.TableRange1.Rows(PT.TableRange1.Rows.Count).Row
NR_Row = Range("Print_GivingSummary").Row + Range("Print_GivingSummary").Rows.Count - 1
With Range("Print_GivingSummary")
.Resize(.Rows.Count + PT_Row - NR_Row, .Columns.Count).Name = "Print_GivingSummary"
End With
ActiveSheet.PageSetup.PrintArea = Range("Print_GivingSummary").Address
Columns("B:B").EntireColumn.AutoFit
'Refresh Report Pivot Table
Annual.Activate
RowToPaste = ActiveSheet.Cells(ActiveSheet.Rows.Count, "A").End(xlUp).Row + 1
NR_Row = Range("AnnualSpecials").Row + Range("AnnualSpecials").Rows.Count - 1
With Range("AnnualSpecials")
.Resize(.Rows.Count + RowToPaste - NR_Row, .Columns.Count).Name = "AnnualSpecials"
End With
Reports.Activate
Set PT = ActiveSheet.PivotTables("PT_RptSpecials")
PT.RefreshTable
PT_Row = PT.TableRange1.Rows(PT.TableRange1.Rows.Count).Row
NR_Row = Range("Print_Report").Row + Range("Print_Report").Rows.Count - 1
With Range("Print_Report")
.Resize(.Rows.Count + PT_Row - NR_Row, .Columns.Count).Name = "Print_Report"
End With
ActiveSheet.PageSetup.PrintArea = Range("Print_Report").Address
Columns("B:B").EntireColumn.AutoFit
Entry.Activate
Set PT = Nothing
End Sub
Last edited by a moderator: