error 1004

sheshe123

New Member
Joined
Sep 24, 2020
Messages
2
Office Version
  1. 2019
Platform
  1. Windows
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.


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:

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Hi sheshe 123 and Welcome to the Board. Trial explicitly declaring all of your variables. When U Dim...
Code:
Dim NumRows, RowToPaste, NR_Row, PT_Row  As Long
only the PT_Row is long and the rest are Variant variables and XL just does whatever it wants. ie......
Code:
Dim  NumRows As Long, RowToPast As Long, NR_Row As Long, PT_Row  As Long
HTH. Dave
 
Upvote 0
Hi sheshe 123 and Welcome to the Board. Trial explicitly declaring all of your variables. When U Dim...
Code:
Dim NumRows, RowToPaste, NR_Row, PT_Row  As Long
only the PT_Row is long and the rest are Variant variables and XL just does whatever it wants. ie......
Code:
Dim  NumRows As Long, RowToPast As Long, NR_Row As Long, PT_Row  As Long
HTH. Dave
hi again. the issue resolved itself on the original file it saves and works just great. however when i try to save it to a usb then apply it to a shared computer i get the error again.
or I get active workbook .SAVECOPYAS strgivingFileName.
I don't know anything about actual coding but the goal is to take the completed file and move it to a different computer .
 
Upvote 0

Forum statistics

Threads
1,213,510
Messages
6,114,044
Members
448,543
Latest member
MartinLarkin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top