Find Function Within Protected Sheet

graviz

Registered User.
Local time
Yesterday, 19:21
Joined
Aug 4, 2009
Messages
167
I have a column of part numbers (Column “A”) that is protected from the user to select them. This is so they don’t alter them as well as only make the cells they can edit assessable. I would like to give them the ability to search for a part number using the “Find” function but since the cells are locked it doesn’t work. I know I could lock them for editing but allow them to select locked cells but I would prefer not to if I could fix it using code. Any ideas on how to accomplish this? Can I use some code to unprotect the sheet when they use the “Find” function and protect it again when they’ve found the number and/or hit cancel?
 
Hi Graviz,

From what I can tell I think a macro utilizing the code below should work. Note that you should have a textbox present in the sheet you are using. Also replace YourPassword with the password you use and Sheet1 with the name of the sheet containing your data and textbox.

ActiveSheet.Unprotect ("YourPassword")

SearchCriteria = Sheets("Sheet1").TextBox1.Value
Selection.AutoFilter Field:=1, Criteria1:=SearchCriteria

ActiveSheet.Protect ("YourPassword")

Hope this helps. :)
 

Users who are viewing this thread

Back
Top Bottom