I am having trouble with a macro that I am using to autofilter a table. I am looking to have the macro return all entries in cells P6 thru P625 that are either "Development" or "MS" and to display these. I used the code below (attached to a ActiveX command button) and it is not working. The worksheet has a password so I started with unprotecting the sheet (then reprotecting after running the filter). Any ideas where I went wrong?
Private Sub CommandButton1_Click() ActiveSheet.Unprotect Password:="xxxx" Range("P6:P625").AutoFilter Field:=1, Criteria1:="Development", Operator:=xlOr, Criteria2:="MS" ActiveSheet.Protect Password:="xxxx" End Sub