abdelfattah
New member
- Joined
- Jul 17, 2020
- Messages
- 10
- Reaction score
- 0
- Points
- 0
- Excel Version(s)
- 2010
hello
i try filter data based on two values in e2,f2 based on column a and copy to sheet2 but it gives me error in this line
thanks
i try filter data based on two values in e2,f2 based on column a and copy to sheet2 but it gives me error in this line
HTML:
If Not IsEmpty(Enter.Range("E2")) And Not IsEmpty(Entry.Range("f2")) Then
HTML:
Sub filter()
Dim ws As Worksheet
Dim Enter As Worksheet
Set ws = ThisWorkbook.Sheets("sheet2")
Set Enter = ThisWorkbook.Sheets("sheet1")
If Not IsEmpty(Enter.Range("E2")) And Not IsEmpty(Entry.Range("f2")) Then
With ws
.Range("$a$2:$a$" & .Range("a" & Rows.Count).End(xlUp).Row).AutoFilter Field:=1, _ Criteria1:=">" & Enter.Range("E2").Value, _
Operator:=xlAnd, _
Criteria2:="<" & Entry.Range("f2").Value
End With
End If
End Sub
Attachments
Last edited: