Multiple Filters with OR Criteria

CorrieAnn

New Member
Joined
Sep 4, 2007
Messages
36
Office Version
  1. 365
Platform
  1. Windows
We have an Excel sheet that is a database of tasks used to manage work assignments for about 10 people in the office. As it is today, a staff member can click on a control on the sheet with their name and the list will filter out blank records, displaying to them just their tasks that are not in any closed or completed status; basically, just the tasks they still have to work on. I have the following code, which works just fine:

VBA Code:
Sub TASKS_Owner_Frances()
'
' Display tasks for Frances
'
    ActiveSheet.Range("$A$6:$BU$1010").AutoFilter Field:=13, Criteria1:="<>" 'this is in here just to avoid an error when toggling from one user to the next...it otherwise serves no purpose
    ActiveSheet.ShowAllData 'remove any pre-applied filters
    ActiveSheet.Range("$A$6:$CA$1010").AutoFilter Field:=25, Criteria1:=Array( _
        "Not Started", "On Hold", "Paused", "Started"), Operator:=xlFilterValues 'display only active tasks
    ActiveSheet.Range("$A$6:$BU$1010").AutoFilter Field:=17, Criteria1:= _
        "Frances" 'tasks originally assigned to Frances
    ActiveSheet.Range("$A$6:$BU$1010").AutoFilter Field:=21, Criteria1:="=" 'task has not been reassigned
End Sub

However, we introduced a new column: "Reassigned To" which are tasks originally assigned to one staff member but were delegated to someone else. These now need to be included in an employee's search of their own specifically assigned tasks. I am trying to incorporate an OR statement in the filtered record results, but am having no luck. Can someone help adjust the code? I feel I am missing something simple here:

VBA Code:
Sub TASKS_Owner_FrancesTest()
'
' Display tasks and reassigned tasks for Frances
'
    ActiveSheet.Range("$A$6:$BU$1010").AutoFilter Field:=13, Criteria1:="<>"
    ActiveSheet.ShowAllData
    ActiveSheet.Range("$A$6:$CA$1010").AutoFilter Field:=25, Criteria1:=Array( _
        "Not Started", "On Hold", "Paused", "Started"), Operator:=xlFilterValues
    With ActiveSheet.Range("$A$6:$BU$1010")
    .AutoFilter Field:=21, Criteria1:="Frances", Operator:=xlOr 'reassigned field
    .AutoFilter Field:=17, Criteria2:="Frances", Operator:=xlOr 'assigned to field
    .AutoFilter Field:=21, Criteria2:="=" 'reassigned field...we want it to be blank in this instance, otherwise it wouldn't belong to Frances
    End With
End Sub
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

Forum statistics

Threads
1,223,236
Messages
6,170,906
Members
452,366
Latest member
TePunaBloke

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