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
    Posts
    332
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    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.

    Code:
    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:

    Code:
    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 here...here's the macro recorder code FYI:


    Code:
    
    Sheets("STR").Select
    
    
    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
  •