+ Reply to Thread
Results 1 to 3 of 3

VBA =GetPivotData() producing runtime error 1004

  1. #1
    Registered User
    Join Date
    10-27-2012
    Location
    Uk
    MS-Off Ver
    Excel 2010
    Posts
    98

    Question VBA =GetPivotData() producing runtime error 1004

    I All,

    I have a sub called SumTBCs that loops through sheets where the sheet name begins 'SLA...' and adds up any pivot table subtotals where the pivot table result is "TBC"

    It was working I'm sure.
    But now it works intermittently.

    I've attached a sample workbook to test

    TBCs Example.png

    There's no "TBC" results in SLA1 to test.

    Running the first sub in sheet 'SLA2' produces a MsgBox displaying '7' which is correct

    Running the second sub in sheet 'SLA3' produces a runtime error 1004?

    I thought perhaps the sheet was corrupt so I removed it and created it again by copying SLA2, but it made no difference.

    Any advice greatly appreciated,
    All the best
    V
    Last edited by vwhite; 09-11-2020 at 04:36 AM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: VBA =GetPivotData() producing runtime error 1004

    That table is on a different sheet and is now 2 in the pivottable collection

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    10-27-2012
    Location
    Uk
    MS-Off Ver
    Excel 2010
    Posts
    98

    Re: VBA =GetPivotData() producing runtime error 1004

    Ah ha! I don't full understand what apivot collection is but I'm assuming it's different from the pivot table name

    So I changed PivotTables(1). to PivotTables("PivotTable1"). and all is working again

    Thank you so much!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Runtime Error 1004 + Runtime 5
    By jrean042 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-07-2020, 08:16 AM
  2. VBA error: runtime error 1004 : Method range of object - 'Global' failed.
    By Afjio12 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-28-2019, 04:37 AM
  3. Runtime error '1004': Paste special method of range class error.
    By Daryl Zer0 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-05-2014, 01:44 AM
  4. VBA Producing Error Code 1004
    By luke.walker in forum Excel Programming / VBA / Macros
    Replies: 33
    Last Post: 06-29-2014, 10:22 AM
  5. [SOLVED] Vlookup and IsError producing runtime 1004
    By drinkmorewine in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-05-2014, 01:12 AM
  6. [SOLVED] VBA Error: Runtime Error 1004: AutoFilter method of Range class failed
    By jl22stac in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-03-2013, 07:27 PM
  7. [SOLVED] IF-Then-Else loop stopping and producing runtime error 1004
    By Optiprime in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-07-2013, 03:24 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1