filter data with criteria

fayez_MrExcel

Active Member
Joined
Oct 29, 2005
Messages
426
Office Version
  1. 365
Platform
  1. Windows
I placed the code below in Sheet2 (Worksheet_change) to filter all inactive/active employees. These goes fine. But i wanted to add a second criteria of months (i.e. January - December) in sheet 2 (row4, coloumn4in the code below, my problem is I have date (dd/mm/yyyy) in Employeelistsheet:ColumnE. So it will filter the data with 2 given criteria e.g. Employees who are active in the month of June or inactive in the month of March and so on... help please

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row = 3 And Target.Column = 3 Then
'calculate criteria cell in case calculation mode is manual
Worksheets("EmployeeList").Range("G2").Calculate
Worksheets("EmployeeList").Range("Database") _
.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Sheets("EmployeeList").Range("G1:G2"), _
CopyToRange:=Range("A6:D6"), Unique:=False
End If
End Sub
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,181,055
Messages
5,927,861
Members
436,573
Latest member
CMR237

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
Top