katkth7533
New member
- Joined
- Jul 29, 2014
- Messages
- 17
- Reaction score
- 0
- Points
- 0
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?
Thank you
Thank you
Code:
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