Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 440
Default protect sheet using vba

Hi,
If I manually protect a sheet and select use auto filter, that function can
be used when the sheet is protected.
Using a private sub, if I unprotect the sheet, allowing changes to be made,
and then re-protect it, the facility to use auto filter is lost.
Is there a line I can add to this:

Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Unprotect Password:="sulby"
On Error GoTo ws_exit:
Application.EnableEvents = False

"my changes"

ws_exit:
Application.EnableEvents = True
'ActiveSheet.Protect Password:="sulby"
End Sub

to keep the autofilter functionality?

Thanks,
--
Traa Dy Liooar

Jock
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,069
Default protect sheet using vba

In XL2003:

ActiveSheet.Protect Password:="sulby", _
AllowFiltering:=True

Hope this helps,

Hutch

"Jock" wrote:

Hi,
If I manually protect a sheet and select use auto filter, that function can
be used when the sheet is protected.
Using a private sub, if I unprotect the sheet, allowing changes to be made,
and then re-protect it, the facility to use auto filter is lost.
Is there a line I can add to this:

Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Unprotect Password:="sulby"
On Error GoTo ws_exit:
Application.EnableEvents = False

"my changes"

ws_exit:
Application.EnableEvents = True
'ActiveSheet.Protect Password:="sulby"
End Sub

to keep the autofilter functionality?

Thanks,
--
Traa Dy Liooar

Jock

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
protect sheet enyaw Excel Programming 2 August 17th 06 10:33 AM
Protect Workbook Vs Protect Sheet Poor_pakistani New Users to Excel 4 May 25th 06 02:06 PM
Can I protect columns w/in a "List" using Protect Sheet? Diane Excel Discussion (Misc queries) 0 May 10th 06 03:30 PM
Lock and protect cells without protect the sheet Christian[_7_] Excel Programming 6 December 28th 04 04:50 PM
excel - macro code to open a protected sheet, enter passowrd, and then protect sheet arunjoshi[_5_] Excel Programming 1 May 2nd 04 03:50 PM


All times are GMT +1. The time now is 09:20 AM.

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"