protect sheet

tokhimi

Board Regular
Joined
Jul 10, 2010
Messages
61
Hi all help me on macro protection sheets

When im using macro protection sheets with password , but when im press on tool > protection > then unprotect but no need password then will unprotect .???


help.//
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
To protect a sheet with a password try code like this

Code:
ActiveSheet.Protect Password:="your password here"
 
Upvote 0
Sub SetPrintArea()
Sheet2.Unprotect Password:="2287"
'Sets Print Area and prints
ActiveWindow.SelectedSheets("Print Screen").Visible = xlSheetVisible
Sheets("Print Screen").Select
Selection.AutoFilter Field:=1, Criteria1:="<>", Operator:=xlAnd
Dim LstRw As Long
Dim ws As Worksheet
Set ws = Sheets("Print Screen")
With ws
LstRw = .Cells(Rows.Count, "A").End(xlUp).Row
End With
Columns("$A:$H").Select
With ActiveSheet.PageSetup
.FitToPagesWide = 1
ActiveSheet.PageSetup.PrintArea = "A1:H1" & LstRw
End With
Selection.PrintOut Copies:=1, Preview:=True, Collate:=True
MsgBox "See you again @"
Sheet2.Unprotect Password:="PASWORD"
ActiveWindow.SelectedSheets("Print Screen").Visible = xlSheetVisible
Sheets("Print Screen").Select
Selection.AutoFilter Field:=1
ActiveSheet.Protect Password:="PASWORD"
Sheet2.EnableAutoFilter = True
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFiltering:=True
End Sub



HI Vog not working

When im press tools > protection > unprotect then ,all release with no need password .
 
Upvote 0
That code is confusing to say the least.

First you are unprotecting Sheet2 with the password 2287

Then you are unprotecting it again with the password PASWORD

Then you are protecting Print Screen with the password PASWORD
 
Upvote 0
Hi Vog

If all password change to "password" also same

becouse the point is the password is using macro to protect ,but when im normal go to tools > protection > unprotect ,,then will release the protect no need to key password
 
Upvote 0
Try this

Code:
Sub test()
Sheets.Add
ActiveSheet.Protect Password:="password"
End Sub

Can you unprotect the new sheet manually without a password? I cannot.
 
Upvote 0
Hi Vog

i find out already

when i try out with what u post is ok cannot unprotect without password

but u try add this at below

Sheet2.EnableAutoFilter = True
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFiltering:=True

then will release without password
 
Upvote 0
Because you haven't supplied a password!

Rich (BB code):
ActiveSheet.Protect Password:="PASWORD", DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFiltering:=True
 
Upvote 0
" password" if i change to my password also not use;;

hi vog u try to put

Sheet2.EnableAutoFilter = True
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFiltering:=True


on thaT U sent me test 1 u will know what im saying //with
Sheet2.EnableAutoFilter = True
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFiltering:=True
and without this different tools > protect > unprotect
 
Upvote 0
When im using macro protection sheets with password
when im press on tool > protection > then unprotect
then no need password then will unprotect .???


Sub test()
Sheets.Add
ActiveSheet.Protect Password:="123"
Sheet2.EnableAutoFilter = True
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFiltering:=True

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,593
Messages
6,120,435
Members
448,961
Latest member
nzskater

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top