Protecting cell contents and using autofilter

elTwitcho

New Member
Joined
May 29, 2003
Messages
4
Alright I'm just setting up a workbook for some people at work who are somewhat excel illiterate (and I'm only slightly less illiterate :wink: ) and I was wondering if anyone knew a way that I could protect the sheet so that nobody accidentally screws up my formulas after I leave (only here for the summer) but at the same time still have the autofilter tabs work. I'd like to be able to leave the autofilter tabs on since it would be useful to have, however it's pretty likely that if somebody screws up a formula nobody is going to figure out how to fix it.

Any and all help would be greatly appreciated
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Put this in the Workbook module:

<font face=Courier New>
<SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> Workbook_Open()
    <SPAN style="color:#00007F">With</SPAN> Sheets("Sheet1")
        .EnableAutoFilter = <SPAN style="color:#00007F">True</SPAN>
        .Protect "password", UserInterfaceOnly:=<SPAN style="color:#00007F">True</SPAN>
    <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN>
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
</FONT>

and change the sheet name (And the password)
 
Upvote 0
What would be the code to protect the whole workbook instead of just a worksheet?

Juan Pablo González said:
Put this in the Workbook module:

<font face=Courier New>
<SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> Workbook_Open()
    <SPAN style="color:#00007F">With</SPAN> Sheets("Sheet1")
        .EnableAutoFilter = <SPAN style="color:#00007F">True</SPAN>
        .Protect "password", UserInterfaceOnly:=<SPAN style="color:#00007F">True</SPAN>
    <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN>
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
</FONT>

and change the sheet name (And the password)
 
Upvote 0
Oh I am sorry. The code below is to protect Sheet1. How do you protect a whole workbook (with 3 sheets)?

Private Sub Workbook_Open()
With Sheets("Sheet1")
.EnableAutoFilter = True
.Protect "password", UserInterfaceOnly:=True
End With
End Sub
 
Upvote 0
I mean how to protect the whole workbook from users, not matter how many worksheets it has. But it would still allow user interface such as Advanced Filter.
 
Upvote 0

Forum statistics

Threads
1,223,947
Messages
6,175,563
Members
452,652
Latest member
eduedu

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