![]() |
Cannot Reset a Protected List
Using Excel 2003. I created a Reset Macro to reset all AutoFilters to €śAll€ť
in a list. The macro looks like: Sub Reset() Range("A6").Select Selection.AutoFilter Field:=1 Range("B6").Select Selection.AutoFilter Field:=2 End Sub The above works fine until I password-protect the worksheet, and then I get a €śRun Time Error 1004 , cannot use this command on a protected t sheet€ť. Even though I allow users to Sort & Use Autofilter. Any suggestions? Thanks in advance for your help. -- Merci! Bonzai |
Cannot Reset a Protected List
try something like this
Sub Reset() Dim ws As Worksheet Set ws = Worksheets("Sheet1") With ws .Unprotect Password:="password" With .Range("A6") .AutoFilter Field:=1 .AutoFilter Field:=2 End With .Protect Password:="password" End With End Sub -- Gary "Bonzai" wrote in message ... Using Excel 2003. I created a Reset Macro to reset all AutoFilters to "All" in a list. The macro looks like: Sub Reset() Range("A6").Select Selection.AutoFilter Field:=1 Range("B6").Select Selection.AutoFilter Field:=2 End Sub The above works fine until I password-protect the worksheet, and then I get a "Run Time Error 1004 , cannot use this command on a protected t sheet". Even though I allow users to Sort & Use Autofilter. Any suggestions? Thanks in advance for your help. -- Merci! Bonzai |
Cannot Reset a Protected List
Thank you very much Gary, it worked!
-- Merci! Bonzai "Gary Keramidas" wrote: try something like this Sub Reset() Dim ws As Worksheet Set ws = Worksheets("Sheet1") With ws .Unprotect Password:="password" With .Range("A6") .AutoFilter Field:=1 .AutoFilter Field:=2 End With .Protect Password:="password" End With End Sub -- Gary "Bonzai" wrote in message ... Using Excel 2003. I created a Reset Macro to reset all AutoFilters to "All" in a list. The macro looks like: Sub Reset() Range("A6").Select Selection.AutoFilter Field:=1 Range("B6").Select Selection.AutoFilter Field:=2 End Sub The above works fine until I password-protect the worksheet, and then I get a "Run Time Error 1004 , cannot use this command on a protected t sheet". Even though I allow users to Sort & Use Autofilter. Any suggestions? Thanks in advance for your help. -- Merci! Bonzai |
All times are GMT +1. The time now is 09:56 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com