Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default Filtering protected sheets (again).

Can we enable filtering more than once so that it still works even after any
toolbar command selected from the floating commandbar re-protects the sheet?

I searched the archives yet again and found 2 messages again both with code
kindly provided by Tom Ogilgy:

Sub AllowFilter()
ActiveSheet.EnableAutoFilter = True
ActiveSheet.Protect UserInterFaceOnly:=True
End Sub

Sub Auto_Open()
With Worksheets("Sheet1")
.EnableAutofilter = True
.Protect UserInterfaceOnly:= True
End With
End Sub

The Auto_Open prompted an idea. I've been using a variation of the first
code above in the ThisWorkbook so that filtering is enabled upon opening the
workbook. Yet the moment any of the commandbar codes are pressed the
filtering then promptly is disabled since each has an "ActiveSheet.Protect"
code at the end. [A corresponding unprotect code is put at the beginning of
each macro so that sorting, etc., can be done. These two codes must
remain.]

So the goal is to find something that can be placed after that
"ActiveSheet.Protect" line in each macro so that the user is allowed to
manually filter the sheet without nullifying the ActiveSheet.Protect. That
would be the crux of the matter, I'm guessing -- whether or not that can be
done? TIA.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Filtering protected sheets (again).

Hi StargateFen,

Try removing the unprotect / re-protect instructions from the
"commandbar codes".

If you use the AutoOpen code from Tom. the sheet will remain
protected but will enable VBA interaction with the sheet. For the
user the sheet is protected but Vba is able to to handle the sheet
as if it were not protected.


---
Regards,
Norman


"StargateFanFromWork" wrote in message
...
Can we enable filtering more than once so that it still works even after
any toolbar command selected from the floating commandbar re-protects the
sheet?

I searched the archives yet again and found 2 messages again both with
code kindly provided by Tom Ogilgy:

Sub AllowFilter()
ActiveSheet.EnableAutoFilter = True
ActiveSheet.Protect UserInterFaceOnly:=True
End Sub

Sub Auto_Open()
With Worksheets("Sheet1")
.EnableAutofilter = True
.Protect UserInterfaceOnly:= True
End With
End Sub

The Auto_Open prompted an idea. I've been using a variation of the first
code above in the ThisWorkbook so that filtering is enabled upon opening
the workbook. Yet the moment any of the commandbar codes are pressed the
filtering then promptly is disabled since each has an
"ActiveSheet.Protect" code at the end. [A corresponding unprotect code is
put at the beginning of each macro so that sorting, etc., can be done.
These two codes must remain.]

So the goal is to find something that can be placed after that
"ActiveSheet.Protect" line in each macro so that the user is allowed to
manually filter the sheet without nullifying the ActiveSheet.Protect.
That would be the crux of the matter, I'm guessing -- whether or not that
can be done? TIA.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filtering on a protected Sheet [email protected] Excel Discussion (Misc queries) 2 August 15th 07 09:39 PM
Macro for filter on protected workbook that works for all sheets, no matter what sheets are named? StargateFanFromWork[_3_] Excel Programming 6 January 26th 06 06:31 PM
Filtering for multiple sheets JVDM Excel Discussion (Misc queries) 1 October 11th 05 10:50 PM
Filtering a protected WS in a shared workbook - Excel 2000 Phuong Nguyen Excel Discussion (Misc queries) 3 February 18th 05 10:28 PM


All times are GMT +1. The time now is 03:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"