+ Reply to Thread
Results 1 to 4 of 4

For Each loop for data labels in a pivot table

  1. #1
    Registered User
    Join Date
    04-10-2014
    Location
    Tallahassee, FL
    MS-Off Ver
    Excel 2010
    Posts
    98

    For Each loop for data labels in a pivot table

    Please Login or Register  to view this content.
    This is the present manner that I am having to cycle through all the entries in my pivot table. Unfortunately, planning ahead, I forsee that there will be more entries than just Alpha, Beta, Gamma, and Delta, and those may potentially be absent.

    Thus, I am trying to find out if there is some way to cycle through ALL entries with a For...Each loop to cycle through all pivot labels, regardless if they were listed before.

    Any help would be appreciated, including a manner in which I can re-write the code above to remove the "Selection" part, because that's just being annoying with screen flashes.
    Last edited by Phixer; 05-12-2015 at 07:51 AM. Reason: Correction

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,300

    Re: For Each loop for data labels in a pivot table

    I haven't tested the formatting you're applying, but could you not create a pivot table style?
    Anyone who confuses correlation and causation ends up dead.

  3. #3
    Registered User
    Join Date
    04-10-2014
    Location
    Tallahassee, FL
    MS-Off Ver
    Excel 2010
    Posts
    98

    Re: For Each loop for data labels in a pivot table

    That is not what I was asking. Applying the formatting is easily done.

    I need to know how to cycle through all the pivot labels to apply formatting (any formatting) to each.

    ...

    Or are you saying that if I create a pivot table style it will automatically apply the formatting to the labels for me? I was unaware if that is the case. I will experiment.

    EDIT:
    I can get the first two sets of labels to color properly, but the third seems to be locked so I can't change the text color. I can change the background color, but the font needs to be white due to the dark background. That part of the code doesn't seem to do anything, regardless if I do it manually or attempt to do it through VBA.

    Please Login or Register  to view this content.
    Last edited by Phixer; 05-12-2015 at 11:26 AM. Reason: Correction then Clarification then revised code

  4. #4
    Registered User
    Join Date
    04-10-2014
    Location
    Tallahassee, FL
    MS-Off Ver
    Excel 2010
    Posts
    98

    Re: For Each loop for data labels in a pivot table

    Ok, I have resolved the issue.

    The problem was, later in the code, the .numberformat was somehow changing it from white back to black (even though the color was unspecified in the .numberformat).

    Once I changed the formatting range on the .numberformat to not include the pivot table labels it stays white.

+ 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. Change chart/pivot table numeric labels to associated text labels
    By petschek in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 02-07-2014, 05:32 PM
  2. Pivot Table - Show Row labels horizontally (Not as Column labels)
    By Catsup in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 01-16-2014, 01:15 PM
  3. Replies: 4
    Last Post: 09-11-2013, 10:22 AM
  4. Replies: 0
    Last Post: 07-03-2012, 11:09 AM
  5. Replies: 6
    Last Post: 03-19-2012, 04:50 AM

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