cant use VBA to make pivot
Results 1 to 1 of 1

Thread: cant use VBA to make pivot
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    Feb 2013
    Post Thanks / Like
    1 Post(s)
    0 Thread(s)

    Default cant use VBA to make pivot

    this code is preventing it from working..I get "failed to create pivotache" or something along those lines.

    set cachePT = activeworkbook.pivotcaches.create(xldatabase, range("source_pivot"))

    i'm trying to create the pivot in the "summary" sheet while "source pivot" is based on the "STR" sheet.

    i've tried the following to no avail:

    set cachePT = activeworkbook.pivotcaches.create(xldatabase, sheets("STR").range("source_pivot"))

    for now, i've resorted to using the macro recorder to create by pivot, but I really want to know why the pivotcache is failing's the macro recorder code FYI:

    finalrow = Cells(Rows.Count, "A").End(xlUp).Row
          ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
            "STR!R1C1:R" & finalrow & "C16").CreatePivotTable _
            TableDestination:="Summary!R1C1", TableName:="str"
    Last edited by daveyc18; Aug 23rd, 2019 at 04:46 PM.

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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