ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   AUTOFILTER IN A PROTECTED WORKSHEET (https://www.excelbanter.com/excel-discussion-misc-queries/199881-autofilter-protected-worksheet.html)

William

AUTOFILTER IN A PROTECTED WORKSHEET
 
I have a spreadsheet that has some colomns comprised completely of locked
cells, with the exception of the header column. Other columns have no locked
cells. However, after I protect the worksheet, the autofilter option is
greyed out for ALL the columns. I was hoping there was a way to be able to
autofilter the columns that have no locked cells while the worksheet is
protected. Is this possible?
--
William

Dave Peterson

AUTOFILTER IN A PROTECTED WORKSHEET
 
If you already have the outline/subtotals/autofilter applied, you can protect
the worksheet in code (auto_open/workbook_open??).

Option Explicit
Sub auto_open()
With Worksheets("sheet1")
.Protect Password:="hi", userinterfaceonly:=True
'.EnableOutlining = True
.EnableAutoFilter = True
'If .FilterMode Then
' .ShowAllData
'End If
End With
End Sub

It needs to be reset each time you open the workbook. (Earlier versions of
excel don't remember it after closing the workbook. IIRC, xl2002+ will remember
the allow autofilter setting under tools|Protection|protect sheet, but that
won't help when you're filtering via code.)

If you're new to macros:

Debra Dalgleish has some notes how to implement macros he
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)


William wrote:

I have a spreadsheet that has some colomns comprised completely of locked
cells, with the exception of the header column. Other columns have no locked
cells. However, after I protect the worksheet, the autofilter option is
greyed out for ALL the columns. I was hoping there was a way to be able to
autofilter the columns that have no locked cells while the worksheet is
protected. Is this possible?
--
William


--

Dave Peterson


All times are GMT +1. The time now is 08:50 AM.

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