+ Reply to Thread
Results 1 to 16 of 16

run-time error 1004 pivot table field name is not valid

  1. #1
    Registered User
    Join Date
    08-16-2018
    Location
    Asgard
    MS-Off Ver
    2013
    Posts
    8

    run-time error 1004 pivot table field name is not valid

    Hi all,

    I've encountered the error message (in title). I tried searching the web for a solution but with no luck.

    the code segment that receives the error:

    Please Login or Register  to view this content.
    when the "set pt= ..." gets highlighted
    Last edited by OmerBD; 08-16-2018 at 04:36 AM. Reason: mistake

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: run-time error 1004 pivot table field name is not valid

    without having anything else to test
    only two things to suggest

    did you put in worksheet variable for loadport?? if not then replace with Worksheets("loadport")

    try it without Version:=xlPivotTableVersion15

    ALSO
    Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    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,903

    Re: run-time error 1004 pivot table field name is not valid

    Do you have any blank headers on the sheet, or invalid characters in row 1? Can you manually create a pivot table from the data on that sheet without getting the same error?
    Rory

  4. #4
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: run-time error 1004 pivot table field name is not valid

    Ok So PT line instead of PC

    PT line do you have a pivot table with that name already?

  5. #5
    Registered User
    Join Date
    08-16-2018
    Location
    Asgard
    MS-Off Ver
    2013
    Posts
    8

    Re: run-time error 1004 pivot table field name is not valid

    Hi humdingaling,

    I made a mistake in my post.. the highlighted row is the "set pt = pc.create (etc')".

    Thanks

  6. #6
    Registered User
    Join Date
    08-16-2018
    Location
    Asgard
    MS-Off Ver
    2013
    Posts
    8

    Re: run-time error 1004 pivot table field name is not valid

    Quote Originally Posted by humdingaling View Post
    Ok So PT line instead of PC

    PT line do you have a pivot table with that name already?
    with what name? pt or "LPPivot"

  7. #7
    Registered User
    Join Date
    08-16-2018
    Location
    Asgard
    MS-Off Ver
    2013
    Posts
    8

    Re: run-time error 1004 pivot table field name is not valid

    Quote Originally Posted by rorya View Post
    Do you have any blank headers on the sheet, or invalid characters in row 1? Can you manually create a pivot table from the data on that sheet without getting the same error?
    Hi Rory,

    No blank headers or invalid characters. I can create the pivot table manually.

  8. #8
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: run-time error 1004 pivot table field name is not valid

    TableName:="LPPivot"

    you can only have one pivot table with the same name at one time

  9. #9
    Registered User
    Join Date
    08-16-2018
    Location
    Asgard
    MS-Off Ver
    2013
    Posts
    8
    Quote Originally Posted by humdingaling View Post
    TableName:="LPPivot"

    you can only have one pivot table with the same name at one time
    No other Pivot Table has that name. Each pivot is with a different name.

  10. #10
    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,903

    Re: run-time error 1004 pivot table field name is not valid

    Does this return the range you expect:

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    08-16-2018
    Location
    Asgard
    MS-Off Ver
    2013
    Posts
    8

    Re: run-time error 1004 pivot table field name is not valid

    Quote Originally Posted by rorya View Post
    Does this return the range you expect:

    Please Login or Register  to view this content.
    Yep, exactly the range.

  12. #12
    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,903

    Re: run-time error 1004 pivot table field name is not valid

    Try changing this:

    Please Login or Register  to view this content.
    to this:

    Please Login or Register  to view this content.
    If that doesn't work, I think we need to see a workbook.

  13. #13
    Registered User
    Join Date
    08-16-2018
    Location
    Asgard
    MS-Off Ver
    2013
    Posts
    8

    Re: run-time error 1004 pivot table field name is not valid

    Quote Originally Posted by rorya View Post
    Try changing this:

    Please Login or Register  to view this content.
    to this:

    Please Login or Register  to view this content.
    If that doesn't work, I think we need to see a workbook.

    I've changed it. appear to be working. but the
    Please Login or Register  to view this content.
    gives me an error: "unable to get the PivotTables property of the worksheet class".

    (I can leave the PT with the default style if it is a problem)


    Much appreciation for the help!!
    Last edited by OmerBD; 08-16-2018 at 08:26 AM.

  14. #14
    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,903

    Re: run-time error 1004 pivot table field name is not valid

    Use pt instead of ActiveSheet.PivotTables("LoadPortPivot")

  15. #15
    Registered User
    Join Date
    08-16-2018
    Location
    Asgard
    MS-Off Ver
    2013
    Posts
    8

    Re: run-time error 1004 pivot table field name is not valid

    Quote Originally Posted by rorya View Post
    Use pt instead of ActiveSheet.PivotTables("LoadPortPivot")
    Thanks a lot!!!

  16. #16
    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,903

    Re: run-time error 1004 pivot table field name is not valid

    Glad to 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. Creating Pivot Table with VBA error 1004 Field not valid
    By JordtenBulte in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-10-2017, 10:38 PM
  2. excel run-time error 1004 pivot table field name is not valid
    By kentiq13 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-15-2016, 08:36 AM
  3. [SOLVED] So frustrated with this: "Run-time error '1004': The PivotTable field name is not valid"
    By vodka in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-14-2016, 11:16 AM
  4. Error 1004: PivotTable field name is not valid
    By pschris in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-07-2015, 11:27 PM
  5. Error 1004: PivotTable field name is not valid
    By pschris in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-25-2015, 09:38 AM
  6. VBA: Pivot Tables / Error 1004: Pivot Table Not Valid
    By vidyuthrajesh in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-22-2013, 03:54 PM
  7. pivot table refresh - error 1004 - reference is not valid
    By jrussell in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-14-2008, 05:08 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