ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Turning Filters ON in a Protected Shared Worksheet (https://www.excelbanter.com/excel-programming/291890-turning-filters-protected-shared-worksheet.html)

GARY

Turning Filters ON in a Protected Shared Worksheet
 
I have a shared worksheet that needs to have columns
protected. I also need filters on.

I can do it with VB in a non shared worksheet.

Must I use VB and can you help?

Thanks
Gary

Dave Peterson[_3_]

Turning Filters ON in a Protected Shared Worksheet
 
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", _
DrawingObjects:=False, Contents:=True, Scenarios:=True, _
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.

And they work on a shared workbook.

I think you'll have to upgrade to xl2002 (if you're not there already) to use
autofilter on a protected worksheet in a shared workbook.

I don't think that there's a workaround in earlier versions.



Gary wrote:

I have a shared worksheet that needs to have columns
protected. I also need filters on.

I can do it with VB in a non shared worksheet.

Must I use VB and can you help?

Thanks
Gary


--

Dave Peterson



All times are GMT +1. The time now is 12:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com