Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filtering

Status
Not open for further replies.

max1565

Technical User
Dec 16, 2002
57
US
Is it possible to filter with the criteria being from an listbox? For instance say there is a column A on worksheet1 with a list of names where a specific name may occur many times.

How would you use the name the user selects as the filtering criteria.

Thanks
 
Hi,

Use this macro

Sub FilterCriteria()

Selection.AutoFilter
Selection.AutoFilter Field:=2, Criteria1:=ActiveCell
End Sub


Jean-Paul
Montreal
jp@solutionsvba.com
mtljp2@sympatico.ca
 
Hi,
Sorry , if it’s column A, it should be like that:
Use this macro

Sub FilterCriteria()

Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:=ActiveCell
End Sub


Jean-Paul
Montreal
jp@solutionsvba.com
mtljp2@sympatico.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top