filter data with criteria

fayez_MrExcel

Active Member
Joined
Oct 29, 2005
Messages
439
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

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Forum statistics

Threads
1,215,013
Messages
6,122,694
Members
449,092
Latest member
snoom82

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