+ Reply to Thread
Results 1 to 4 of 4

Unable to add CubeField/PivotField as a Data Field in VBA

  1. #1
    Registered User
    Join Date
    03-04-2018
    Location
    New York, NY
    MS-Off Ver
    Office 2016
    Posts
    2

    Question Unable to add CubeField/PivotField as a Data Field in VBA

    I'm working on a very long Macro for my job and I am just about finished, but this is the last part and no matter what I do, I can't seem to figure out the fix. In this PivotTable, I need to have "Managers" as the columns and everything else (i.e. all of the months) in the Values section, with "Values" as the rows. After tinkering around, it seems as though all of the fields registered as CubeFields instead of PivotFields. When I run this, as soon as it gets to .Orientation = xlDataField, it throws a "Run-Time error 5...Invalid procedure call or argument." I also need to make sure that those DataFields are averaged and in a specific number format. Nothing I do works, and any guidance/fixes/workarounds would be greatly appreciated! Below are the macro and a download link to the file for tinkering.


    Please Login or Register  to view this content.
    Also posted this question on MrExcel, SuperUser/Stack Overflow and OzGrid
    Attached Files Attached Files
    Last edited by andrewstahl; 03-04-2018 at 03:54 PM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2407 (Windows 11 23H2 64-bit)
    Posts
    83,185

    Re: Unable to add CubeField/PivotField as a Data Field in VBA

    Rule 08: Cross-posting Without Telling Us

    Your post does not comply with Rule 8 of our Forum RULES. Do not cross-post your question on multiple forums without telling us about your threads on other forums.

    Post a link to any other forums where you have asked the same question. If you have fewer than 10 posts here, you will not be able to post a link, but you must still tell us where else you have asked the question.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).


    Your post does not comply with Rule 3 of our Forum RULES. 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

    No further help to be offered, please, until the OP has complied with these requests.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    03-04-2018
    Location
    New York, NY
    MS-Off Ver
    Office 2016
    Posts
    2

    Re: Unable to add CubeField/PivotField as a Data Field in VBA

    I edited my original post, how can I send you the links to the other forum posts? I need to make sure that this gets answered as soon as possible.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2407 (Windows 11 23H2 64-bit)
    Posts
    83,185

    Re: Unable to add CubeField/PivotField as a Data Field in VBA

    I explained that above. You have too few posts to provide links, so list the names of the other forums where you have asked the same question. And please read our rules before posting again.

    Thanks.

+ 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. Unable to set the CurrebtPage property of the PivotField class
    By MattEd82 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-19-2016, 08:02 AM
  2. Pivottable Cubefield vs PivotField
    By rasonline in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-03-2014, 08:58 AM
  3. Unable to set orientation property of pivotfield class
    By williams485 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-22-2012, 12:51 PM
  4. Unable to set the currentpage property of the pivotfield class
    By adoepker in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-09-2011, 06:23 PM
  5. Unable to set the CurrentPage Property of the PivotField Class
    By Murali6688 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-18-2011, 12:16 PM
  6. Unable to set the CurrentPage Property of the PivotField Class
    By SDruley in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-09-2011, 01:39 PM
  7. Unable to get the PivotItems Property of the PivotField Class
    By vinay_bagare in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-09-2007, 05:06 PM

Tags for this Thread

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