Cell Protection vs Auto Filter

T

TC

Is there any way of protecting cells from being altered,
moved etc, whilst still being able to run an auto filter
on them?

Regards,

TC
 
D

Dave Peterson

Before xl2002:

if the workbook isn't shared, you can protect the sheet in code and allow the
existing autofilter arrows to work:

Option Explicit
Sub auto_open()
With Worksheets("Sheet1")
.Protect Password:="hi", _
userinterfaceonly:=True
.EnableAutoFilter = True
End With
End Sub

It needs to be reset each time you open the workbook. (excel doesn't remember
it after closing the workbook.)

(you could use the workbook_open even under ThisWorkbook, too.)

====
But when the workbook is shared, you can't change the worksheet protection--so
this code will fail.

====

Starting with xl2002, there's an option under tools|protection that allows
existing autofilters to work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top