+ Reply to Thread
Results 1 to 7 of 7

Yesterday macro worked, today it doesn't?

  1. #1
    Registered User
    Join Date
    11-06-2008
    Location
    Illinois
    Posts
    63

    Angry Yesterday macro worked, today it doesn't?

    I use a macro that automatically generates a pivot table, re-formats the data, and then makes sure there are no blanks and that the DATA area of the pivot table is set to SUM OF and not COUNT OF.

    It was working just fine yesterday but today it is giving me the following error and is highlighting this section of my code:

    Please Login or Register  to view this content.
    Run-Time Error '1004': Unable to get the PivotItems property of the PivotField class

    Yesterday this macro worked great. Today it's giving me that error. What gives?
    Last edited by Nickster64; 12-18-2008 at 12:33 PM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Are you sure that you had "(blank)" and not just " "?
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    11-06-2008
    Location
    Illinois
    Posts
    63
    Yes. Yesterday after I ran the macro there was a '(blank)' in my pivot table data. Today I just went ahead and did the process by hand and found that there were no '(blank)' in the data.

    Good eye. I am going to comment that section out of my macro and re-run it.

  4. #4
    Registered User
    Join Date
    11-06-2008
    Location
    Illinois
    Posts
    63
    Bingo! That was the problem. The macro ran fine after I commented those lines out.

    What could do to make the macro continue running anyways if there are no blanks?

    Thanks,

    Nick

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You could add an On Error statement

  6. #6
    Registered User
    Join Date
    11-06-2008
    Location
    Illinois
    Posts
    63
    Great call, thanks royUK.

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ 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