+ Reply to Thread
Results 1 to 8 of 8

run-time error 1004 Unable to get the PivotFields property of the PivotTable Class.

  1. #1
    Forum Contributor
    Join Date
    03-12-2014
    Location
    Riyadh
    MS-Off Ver
    Office 365
    Posts
    129

    run-time error 1004 Unable to get the PivotFields property of the PivotTable Class.

    Hello friends, hope all is well!

    please see the image in which shows the code, the code runs on the cell value of F1. and that should change the result of the pivottable.
    I got this error message: "run-time error 1004 Unable to get the PivotFields property of the PivotTable Class".

    please tell me what I should to correct the code.


    Thank you very much in advance!
    Attached Images Attached Images

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: run-time error 1004 Unable to get the PivotFields property of the PivotTable Class.

    First of all, I highly recommend putting Option Explicit as the first line in the module. This will force you to declare the variables. It is good coding practice.

    Secondly, I recommend attaching a sample workbook. I don't see anything offhand that would cause the error, but there is a lot that I cannot see in pictures alone.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Forum Contributor
    Join Date
    03-12-2014
    Location
    Riyadh
    MS-Off Ver
    Office 365
    Posts
    129

    Re: run-time error 1004 Unable to get the PivotFields property of the PivotTable Class.

    hello there! ok here is the attachment. your kind help is needed and appreciated.
    please help fix the code.
    Attached Files Attached Files

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,922

    Re: run-time error 1004 Unable to get the PivotFields property of the PivotTable Class.

    Based on the other code in your file, it seems you're using the data model, so you should use PivotFields("[Range].[CITY].[CITY]") instead.

  5. #5
    Forum Contributor
    Join Date
    03-12-2014
    Location
    Riyadh
    MS-Off Ver
    Office 365
    Posts
    129

    Re: run-time error 1004 Unable to get the PivotFields property of the PivotTable Class.

    ok sure, but can you please adjust the code. I am curious why it didn't work.

  6. #6
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,922

    Re: run-time error 1004 Unable to get the PivotFields property of the PivotTable Class.

    Please Login or Register  to view this content.
    You may want to update your profile too as it appears you aren't using Excel 2010.

  7. #7
    Forum Contributor
    Join Date
    03-12-2014
    Location
    Riyadh
    MS-Off Ver
    Office 365
    Posts
    129

    Re: run-time error 1004 Unable to get the PivotFields property of the PivotTable Class.

    profile updated. and made the suggested change, however, I got another error. the following line is in yellow:
    Field.CurrentPage = Stng

    Please Login or Register  to view this content.

  8. #8
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,922

    Re: run-time error 1004 Unable to get the PivotFields property of the PivotTable Class.

    I can't test since I only have 2010 here, but try:

    Please Login or Register  to view this content.

+ 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. Error 1004: unable to get the pagefields property of the pivottable class
    By ce_77 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-22-2017, 07:02 AM
  2. Replies: 0
    Last Post: 01-05-2017, 09:55 AM
  3. Run-time error '1004': Unable to get the PivotFields property of the PivotTable class
    By jaimeteele in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-13-2013, 05:43 PM
  4. Unable to get the PivotFields property of the PivotTable Class
    By ajmarti82 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-17-2013, 04:40 PM
  5. unable to get pivotfields property of the pivottable class
    By Punxsu in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-15-2012, 05:45 PM
  6. run-time error 1004 unable to get the pivotfields property of the pivot table class
    By arunsoni in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-23-2011, 02:06 PM
  7. [SOLVED] Unable to get the PivotFields property of the PivotTable Class
    By Karl in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-25-2006, 02:20 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