Auto Filter & Protection

steve case

Well-known Member
Joined
Apr 10, 2002
Messages
823
Well, I'm almost done with the entry & edit forms on this little project, but there's one last wrinkle, and it's what the user really wanted!

It's a simple spreadsheet page with "Auto Filter" buttons at the top of each column. Is there a way to protect the contents of the cells but still allow the auto filter buttons to function?
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
put this in the sheet code
Code:
Private Sub Worksheet_Activate()
    Me.Protect Password:="123", UserInterFaceOnly:=True
    Me.EnableAutoFilter = True
End Sub
 
Upvote 0
You can tweak 97 and 2000 to work as well, something like this in the Workbook module:

<font face=Courier New><SPAN style="color:darkblue">Option</SPAN> <SPAN style="color:darkblue">Explicit</SPAN>

<SPAN style="color:darkblue">Private</SPAN> <SPAN style="color:darkblue">Sub</SPAN> Workbook_Open()
    <SPAN style="color:darkblue">With</SPAN> Sheets("Sheet1")
        .Protect "password", UserInterfaceOnly:=<SPAN style="color:darkblue">True</SPAN>
        .EnableAutoFilter = <SPAN style="color:darkblue">True</SPAN>
    <SPAN style="color:darkblue">End</SPAN> <SPAN style="color:darkblue">With</SPAN>
<SPAN style="color:darkblue">End</SPAN> <SPAN style="color:darkblue">Sub</SPAN></FONT>

It will protect the sheet with a password (Change it accordingly), and will enable the autofilter in Sheet1.
 
Upvote 0
How about this one:

I want users (they have Excel 2000) to be able to edit all cells except for a small range (some data validation conditions). I don't want them to be able to add columns.

I do want them to be able to use autofilter.

Many thanks anyone who is still watching this thread.

Andrew
 
Upvote 0

Forum statistics

Threads
1,215,757
Messages
6,126,695
Members
449,331
Latest member
smckenzie2016

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top