fayez_MrExcel
Active Member
- Joined
- Oct 29, 2005
- Messages
- 444
- Office Version
- 365
- Platform
- 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
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