+ Reply to Thread
Results 1 to 2 of 2

Can't rerun Macro to create pivot table

  1. #1
    Registered User
    Join Date
    07-19-2023
    Location
    New Jersey
    MS-Off Ver
    365
    Posts
    1

    Question Can't rerun Macro to create pivot table

    Hi All, I am very new to using Macros & VBAs trying to streamline some of the processes at my company. I am trying to create a pivot summary first to then create separate files for each Account name. However I am running into an issue where it cannot run the Macro, and I've copied a solution from an online tutorial, but still haven't had luck. Any help would be appreciated. The spot that seems to be causing the error is pivotWS & "!R3C1"

    Sheets.Add
    pivotWS = ActiveSheet.Name

    ActiveWorkbook.PivotCaches.Create(SourceType:=x1Database, SourceData:=
    "Source!R4C1:R56288C51", Version=8).CreatePivotTable TableDestination:=_
    pivotWS & "!R3C1", TableName:="PivotTable36", DefaultVersion:=8
    Sheets(pivotWS).Select

    I know this is probably a simple fix, but my programming knowledge is limited.

    Appreciate any help that can be provided.

  2. #2
    Valued Forum Contributor
    Join Date
    02-06-2014
    Location
    N/A
    MS-Off Ver
    N/A
    Posts
    373

    Re: Can't rerun Macro to create pivot table

    Hiya, here's what I think might be breaking the code:

    Bug #1: the SourceType parameter should be "xlDatabase" not "x1(one)Database"
    Bug #2: the parameter "Version=8" has a syntax error, it should be "Version:=8"
    Bug #3: There needs to be a [space][underscore] after SourceData:= and TableDestination:=

    I think this is going to get you closer to what you want.

    Make sure to wrap any code in
    Please Login or Register  to view this content.
    tags.

    Please Login or Register  to view this content.
    Last edited by 1aaaaaaaaaaaaaaa; 07-19-2023 at 03:37 PM.

+ 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. How to create a dynamic macro that will create pivot table
    By thlee1122 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-08-2015, 11:49 PM
  2. How to create a macro to create a pivot table on a new sheet
    By thlee1122 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-19-2015, 11:14 AM
  3. Create a macro to create a pivot table in a worksheet
    By Triscia in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-15-2015, 10:53 AM
  4. Create 2 pivot table using macro
    By melforce in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-23-2015, 09:19 PM
  5. Macro to create pivot table
    By ldorsi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-01-2012, 05:12 PM
  6. Macro to create pivot table/pivot chart
    By Karina in forum Excel General
    Replies: 2
    Last Post: 10-27-2011, 10:33 PM
  7. Excel 2007 : Macro to create pivot table
    By sloart in forum Excel General
    Replies: 1
    Last Post: 01-03-2011, 08:57 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