+ Reply to Thread
Results 1 to 8 of 8

Pivot cache error debug

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    07-10-2019
    Location
    england
    MS-Off Ver
    2013
    Posts
    486

    Pivot cache error debug

    Hi,
    I am facing this pivot error, i am not able to understand what is the problem..
    My pivot cache code is
     pt.ChangePivotCache ActiveWorkbook. _
            PivotCaches.Create(SourceType:=xlDatabase, SourceData:=Sheets("Ae").Range("A1").CurrentRegion.Address)
    Why am i facing the error, that source should have 2 columns... it is because of the range ("a1")
    Attached Images Attached Images

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,976

    Re: Pivot cache error debug

    You should include the sheet name in the Sourcedata argument:

     pt.ChangePivotCache ActiveWorkbook. _
            PivotCaches.Create(SourceType:=xlDatabase, SourceData:="'Ae'!" & Sheets("Ae").Range("A1").CurrentRegion.Address(referencestyle:=xlr1c1))
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Forum Contributor
    Join Date
    07-10-2019
    Location
    england
    MS-Off Ver
    2013
    Posts
    486

    Re: Pivot cache error debug

    Hi Rorya,
    Thank you.. but why is it so? purpose?
    and kindly look into the
    code not able to understand thread also ..
    i have a code there which comes from access , i think.. but couldnt understand the meaning? kindly if possible explain.. i have a sep. thread for that..

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,976

    Re: Pivot cache error debug

    If you don't, all you are passing is an address like A1:B100, which will default to the active sheet, rather than the one you actually specified.

  5. #5
    Forum Contributor
    Join Date
    07-10-2019
    Location
    england
    MS-Off Ver
    2013
    Posts
    486

    Re: Pivot cache error debug

    Hi Rorya,
    Still getting the same error, eventhough changed it as per your above suggestion..

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,976

    Re: Pivot cache error debug

    Post a workbook then please.

  7. #7
    Forum Contributor
    Join Date
    07-10-2019
    Location
    england
    MS-Off Ver
    2013
    Posts
    486

    Re: Pivot cache error debug

    Sir, the problem is with ranges- when given a1:b500.. it works fine.. but when the range is given as used range or current region, it throws error..
    I have tried changing as per your suggestion too.. it is throwing error..
    i have one doubt.. that current region can it be customised to col a and b alone?

    as for pivot the problem is it is taking other columns other than a and b too , i suppose ie the problem..
    as you told i checked used range goes till az, eventhough the columns are blank..

    sir,kindly see the thread code not able to understand too..
    i dont understand what the code is , the purpose..
    i understand it is trying to get connected to a closed file and copy, but i want to know what the actual syntax used and its meaning..
    can you help it..

  8. #8
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,976

    Re: Pivot cache error debug

    Unless I can see the workbook, I can't tell you why it fails. That code is not using Usedrange, it uses Currentregion.

+ 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. VBA Pivot Table Cache Error
    By Fossette in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-11-2018, 06:36 AM
  2. Pivot Table Macro - Debug Error: Created in 2016 and works, does not work in Excel 2013
    By ashley72788 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-05-2017, 04:07 AM
  3. Pivot cache using vba - Type mismatch error
    By sahilkh18 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-11-2016, 08:07 AM
  4. [SOLVED] Macro to update pivot tables and use the SAME cache instead of repeatedly recreating cache
    By Fowzee1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-22-2015, 11:26 PM
  5. Pivot cache error
    By Ricardo Mass in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-26-2013, 05:06 AM
  6. Pivot Cache VBA code - Application-defined or Object Defined error
    By 4am in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-28-2011, 02:21 PM
  7. [SOLVED] error message with Pivot Cache
    By Wolfram Schneider in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-26-2005, 02:06 AM

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