paradox34690
10-22-2013, 12:41 AM
Hi everyone!
So, I'm sure I'm not the first to ask this, but i haven't found a clear example on the interwebs tonight and have had enough of banging my head.
Situation:
I have a table setup with the following headers, each of them is capable of filtering:
StationCallSign
ProgramTitle
AirStart
EndTime
Date
User
I need to be able to iterate through the filters as explained below and am wondering if it can be done with Autofilters the same way that i would with a PivotTable.
1. User
2. Date
3. ProgramTitle
4. AirStart
Each user will have multiple dates, which will have multiple programtitles, which MAY have multiple AirStart values. Once it gets to that point, I have the rest, it's getting there that I don't know about.
Is it possible to iterate through each of these similar to this? This example is for how to sloppily iterate through all values on a pivot table to select/deselect items automatically:
Dim PT As PivotTable
Set PT = Sheets("Sheet1").PivotTables("PivotTable1")
username = Sheets("Sheet1").Range("A4").Text
For Each Pi In PT.PivotFields("User").PivotItems
If (Pi.Value = username) Or (Pi.Value = "(blank)") Then
Pi.Visible = True
Else
Pi.Visible = False
End If
Next Pi
Can I do a nested "For Each item in Autofilter.Criteria1" << I know this is not the correct way of writing, i simply have no other idea of how to explain it. Please let me know if I don't make sense and I will do what I can to make sense.
So, I'm sure I'm not the first to ask this, but i haven't found a clear example on the interwebs tonight and have had enough of banging my head.
Situation:
I have a table setup with the following headers, each of them is capable of filtering:
StationCallSign
ProgramTitle
AirStart
EndTime
Date
User
I need to be able to iterate through the filters as explained below and am wondering if it can be done with Autofilters the same way that i would with a PivotTable.
1. User
2. Date
3. ProgramTitle
4. AirStart
Each user will have multiple dates, which will have multiple programtitles, which MAY have multiple AirStart values. Once it gets to that point, I have the rest, it's getting there that I don't know about.
Is it possible to iterate through each of these similar to this? This example is for how to sloppily iterate through all values on a pivot table to select/deselect items automatically:
Dim PT As PivotTable
Set PT = Sheets("Sheet1").PivotTables("PivotTable1")
username = Sheets("Sheet1").Range("A4").Text
For Each Pi In PT.PivotFields("User").PivotItems
If (Pi.Value = username) Or (Pi.Value = "(blank)") Then
Pi.Visible = True
Else
Pi.Visible = False
End If
Next Pi
Can I do a nested "For Each item in Autofilter.Criteria1" << I know this is not the correct way of writing, i simply have no other idea of how to explain it. Please let me know if I don't make sense and I will do what I can to make sense.