+ Reply to Thread
Results 1 to 3 of 3

Automate a pivot table

  1. #1
    Registered User
    Join Date
    04-20-2008
    Posts
    33

    Automate a pivot table

    Hi all,
    I have a workbook that starts blank everytime time its opened, and at the push of a button launches a macro that imports some data, sorts and formats it. All good so far. I am able to create a pivot table (using the wizard) to analyse the data I am left with and display the desired results, but I would like to be able to automate this process, so that the table 'appears' when the original macro has done its work and sorted the data. I have tried (cheating?) recording a macro of the pivot table wizard, but it fails to run and I am not capable of fixing the programing.
    Is there an easy way to automate the pivot table process or a macro that can be written that will work?
    Here is the code generated by the record macro function
    Please Login or Register  to view this content.
    It hangs up at the first 'with' statement, not sure why, but its a simple table, with only the 3 columns of data in it. Any help will be much appreciated,
    Cheers,


    EDIT: It pays to have a thorough check of all code eh? For whatever reason, when the macro was recorded, it give erroneous array for the source data - once I spotted this and changed it to the correct values, it all works.
    Last edited by BLRITCHIE; 11-18-2009 at 01:48 AM.

  2. #2
    Valued Forum Contributor JeanRage's Avatar
    Join Date
    03-02-2009
    Location
    Nice, France
    MS-Off Ver
    Excel 2003
    Posts
    705

    Re: Automate a pivot table

    Hi,

    It looks as if the source table, in the first instruction, is not correct ...only column C and two rows ...

    HTH

  3. #3
    Registered User
    Join Date
    04-20-2008
    Posts
    33

    Re: Automate a pivot table

    Hi, thanks for your reply - I solved it myself and then edited my post without seeing your answer (had the page open in my browser and didnt refresh - you were spot on though!).
    Cheers, appreciate your time.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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