PDA

View Full Version : Solved: Help AutoFilter 2 criteria at one time



jammer6_9
05-12-2007, 01:46 AM
Hi all, I am trying to AutoFilter 2 criteria at one time but I am unseccessful. I am trying to use "and" but it's not working. What should i use? How can I remove as well the AutoFilter to show all rows.

Private Sub Filter_Click()
Sheets("bhhcomments").Select
Selection.AutoFilter Field:=1, Criteria1:="TEAM"
'another criteria will be "TOOLS"
End Sub

Bob Phillips
05-12-2007, 03:39 AM
Private Sub Filter_Click()
Sheets("bhhcomments").Select
Selection.AutoFilter Field:=1, Criteria1:="TEAM"
Selection.AutoFilter Field:=2, Criteria2:="TOOLS"
End Sub

Haldun
05-12-2007, 04:44 AM
Hi,

If you want to apply two criterias to one column in autofilter area you can use following...
Private Sub Filter_Click()
Sheets("bhhcomments").Select
Selection.AutoFilter Field:=1, Criteria1:="TEAM", Operator:=xlOr, Criteria2:="TOOLS"
End Sub

to show all the rows in autofilter area use

Sheets("bhhcomments").ShowAllData

jammer6_9
05-12-2007, 04:52 AM
:thumb thanks to both of you... I've got more than I wanted to...