Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Mar 2003
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Pivot item indexes vs. values (Excel VBA)

    Hope all is well with everyone. I'm having a problem with the value vs. the index within the pivot fields. My row values are numeric (1 - 70, with some skipped numbers) and I want to turn the visible property to off for any value greater than 21. However, every thing I've tried treats it as an index and will turn off values that have an index higher than 21...anyone have any ideas?

    Thanks,

    Tango

    If mytable.PivotFields("subcat nbr").PivotItems(y.Value).Value < 21 Then

    mytable.PivotFields("subcat nbr").PivotItems(y.Value).Visible = True
    Else
    mytable.PivotFields("subcat nbr").PivotItems(y.Value).Visible = False
    End If
    mynext:
    Next y
    '

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: Pivot item indexes vs. values (Excel VBA)

    Hi,
    Does it help if you use:
    <pre>With mytable.PivotFields("subcat nbr").PivotItems("" & cstr(y.Value))
    If .Value < 21 Then
    .Visible = True
    Else
    .Visible = False
    End If
    End With
    </pre>

    Regards,
    Rory

    Microsoft MVP - Excel

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •