Can't make visible/invisible values that repeat themselves in a dropdown list

overload955

New Member
Joined
Oct 17, 2013
Messages
1
Hi guys. I have a problem and I'm dealing with it for a couple of days already.
I have a pivot table that is made from 4 Row Labels. I'm trying to sort the data from this pivot table based on the data I have in a column called "In Analysis Date". My dropdown list looks like this:
attachment.php


I'm trying to check only the boxes from a certain month and year. I'm ussing the following piece of code for doing that:

Code:
For j = 1 To 400 
    dt = CDate(pvt.RowFields(2).PivotItems(j).Name) 
     
    If month(dt) = m And Year(dt) = y Then 
         
         
        If pvt.RowFields(2).PivotItems(j).Visible = False Then 
            pvt.RowFields(2).PivotItems(j).Visible = True 
        End If 
         
    End If 
Next j

This code works well except the fact that it won't check, for example, the second 10/2/2013 10:08. I don't know why this happens. Basically excel sees that item as being checked but in reality only the first one is checked. This happens for all values that are duplicated. I really don't know how to solve this. An advice from you guys will help me a lot.

Thanks in advance.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Forum statistics

Threads
1,214,377
Messages
6,119,182
Members
448,872
Latest member
lcaw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top