+ Reply to Thread
Results 1 to 5 of 5

Upgrade pivottable after running a macro failes

  1. #1
    Registered User
    Join Date
    02-17-2017
    Location
    Norway
    MS-Off Ver
    2016
    Posts
    10

    Upgrade pivottable after running a macro failes

    I`m trying to create a sheet where I can have pivot tables which can be updated with rawdata once a week. I have a column named Duration(seconds). I have made a macro that perform the following:
    1. Creates a new column with header minutes
    2. Convert seconds to minutes
    So far, so good.
    However, when I delete the raw data, And paste the new raw data and runs the macro and I try do update the pivot diagrams/tables, I receive an error message

    I have one sheet for the raw data , and one sheet for the pivot table(s)

    Something like this (translated from Norwegian)
    Fieldname in pivot table is not valid. The data that is to be used to create a privot table report must be organized as a list with column labels. If you change name on a pivotfield, you have to give a new name to the field.

    My questin is: What???

    Second question is it possible to have an autoupdate of pivot tables?

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: Upgrade pivottable after running a macro failes

    My guess is that you have empty header row or some other table structure violation.

    Upload a sample workbook where you encounter this error (along with your code), with sanitized data.

    And it's definitely possible to auto-update pivottables via code.

  3. #3
    Registered User
    Join Date
    02-17-2017
    Location
    Norway
    MS-Off Ver
    2016
    Posts
    10

    Re: Upgrade pivottable after running a macro failes

    Ok, I have a macro using this formula =convert(c3:"sec":"mn") and the macro also creates a new column to the right of c-column and adds a title Minute. In this example file I have not created a macro, but have manually created a new column, new header and added the formula. I haven`t tried to delete the rawdata sheet used for the pivot table and then copy and paste from the original rawdata in this book.
    Attached Files Attached Files

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: Upgrade pivottable after running a macro failes

    I'd need to see your code to effectively help you.

    However, you can change pivottable source like below. Note that pivotcache source data range string must use R1C1 style reference.

    Assuming PivotCache SourceData is originally set to Worksheets("Original Rawdata").Range("A1:D9")
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-17-2017
    Location
    Norway
    MS-Off Ver
    2016
    Posts
    10

    Re: Upgrade pivottable after running a macro failes

    "Problem" solved. I have still no Idea why it failed, but now it doesn`t. Thanks for all you help

+ 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. Excel Offset/Running totals from a PivotTable
    By hunnel in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-15-2016, 03:51 PM
  2. Macros displaying when a VBA script failes
    By djs_79 in forum Excel General
    Replies: 2
    Last Post: 02-10-2016, 02:56 PM
  3. [SOLVED] UserForm Failes to Open
    By oskar44 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 05-11-2015, 06:23 PM
  4. Excel 2007 : PivotTable running total
    By tech99 in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 09-01-2013, 06:04 AM
  5. [SOLVED] Using clipboard failes
    By Sebas123 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 12-19-2012, 06:56 AM
  6. Calculate Running Total In PivotTable
    By bookstorelee in forum Excel General
    Replies: 0
    Last Post: 02-25-2011, 06:07 AM
  7. [SOLVED] Shadows of the Pivottable Field List while macro is running
    By David P in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-25-2005, 04:06 PM

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