Alphacsulb
Active Member
- Joined
- Mar 20, 2008
- Messages
- 414
I'm attempting to capture an array from filtered results to then use later in a filter.
I tried following this logic but cant figure out how to change it to my needs since I'm only using one sheet.
https://contexturesblog.com/archives/2010/12/15/excel-autofilter-with-criteria-in-a-range/
I hope that is clear.
Thanks for any leads.
I tried following this logic but cant figure out how to change it to my needs since I'm only using one sheet.
https://contexturesblog.com/archives/2010/12/15/excel-autofilter-with-criteria-in-a-range/
Code:
Sub Executive_RSVP()
Dim vCrit As Variant
Sheets("EmailGroupSelection").Select ' using this sheet
ActiveSheet.AutoFilterMode = False ' resets autofilter
ActiveSheet.Range("$F$1:$F$1000").AutoFilter Field:=1, Criteria1:= _
"=*Executive*", Operator:=xlAnd ' Filter Executive's (Column F) to figure out which agency they belong (Column A defines agency)
' This is where I need help capturing the array:
' Capture the non-hidden results from Column A skipping the header row and place as VCrit varient to use in the next filter below.
Columns("A:F").Select
Selection.AutoFilter
ActiveSheet.Range("$F$1:$F$1000").AutoFilter Field:=6, Criteria1:= _
"=*Executive*", Operator:=xlOr, Criteria2:="=*RSVP*" ' Filtered list contains Executives or staff who perform RSVP.
ActiveSheet.Range("$A$1:$A$1000").AutoFilter Field:=1, _
Criteria1:=Application.Transpose(vCrit), _
Operator:=xlFilterValues 'Use the vCrit array to only List RSVP staff if the executive belongs to the agency.
Do Until Application.CalculationState = xlDone
DoEvents
Loop
End Sub
I hope that is clear.
Thanks for any leads.