Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 69
Default Macro- not re-password protecting

Hi:

I am using a macro that involves unprotecting and protecting the sheet at
the beginning and end of the macro. I have used this same code in a different
spreadsheet's macro and it worked fine (including the allow filter part).
However, when I run it on this spreadsheet, it re-protects it at the end, but
WITHOUT the password. the code I am using is as follows:

Sub Macro1()
ActiveSheet.Unprotect Password:="Stars"

(All Macro details go here...)

ActiveSheet.Protect Password:="Stars"
ActiveSheet.Protect AllowFiltering:=True

End Sub

Do you have any idea why it protects it but without the necessary password?
thank you!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Macro- not re-password protecting

The second Activesheet.Protect has no password so wipes out the first
Activesheet.Protect

Use this construct

With ActiveSheet
.Protect Password:="Stars"
.EnableAutoFilter = True
End With


Gord Dibben MS Excel MVP

On Fri, 18 Jul 2008 15:39:00 -0700, Roady
wrote:

Hi:

I am using a macro that involves unprotecting and protecting the sheet at
the beginning and end of the macro. I have used this same code in a different
spreadsheet's macro and it worked fine (including the allow filter part).
However, when I run it on this spreadsheet, it re-protects it at the end, but
WITHOUT the password. the code I am using is as follows:

Sub Macro1()
ActiveSheet.Unprotect Password:="Stars"

(All Macro details go here...)

ActiveSheet.Protect Password:="Stars"
ActiveSheet.Protect AllowFiltering:=True

End Sub

Do you have any idea why it protects it but without the necessary password?
thank you!


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
Password Protecting a worksheet Conker10382 Excel Discussion (Misc queries) 3 March 7th 08 04:41 PM
password protecting worksheet MelB Excel Discussion (Misc queries) 2 October 11th 07 04:01 PM
Password Protecting One Cell Erinayn Excel Discussion (Misc queries) 1 January 11th 07 08:52 PM
Password protecting a worksheet [email protected] Excel Worksheet Functions 2 October 5th 05 09:09 PM
Password Protecting Nick Excel Discussion (Misc queries) 6 June 30th 05 12:06 PM


All times are GMT +1. The time now is 05:38 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"