protect sheet with password

P

pswanie

i got a macro to protect my sheet and then navigate me to another sheet.

i need this macro to protect the sheet with a password and then i need
another macro to unprotect the password protected sheet.

this is what im using now

Sub data()

ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Application.MoveAfterReturnDirection = xlToRight
Sheets("data").Select
Range("A111").Select
End Sub
 
M

Mike H

Possibly

Sub data()
ActiveSheet.Protect Password:="mypass"
Sheets("data").Select
Range("A111").Select
End Sub

Sub data1()
Sheets("Sheet1").Unprotect Password:="mypass"
Sheets("sheet1").Select
Range("A111").Select
End Sub



Mike
 
G

Gord Dibben

Sub SHEETPROTECT()
With ActiveSheet
.Protect Password:="justme", DrawingObjects:=True, _
Contents:=True, Scenarios:=True
.EnableSelection = xlUnlockedCells
Application.MoveAfterReturnDirection = xlToRight
End With
End Sub

Sub SHEETUNPROTECT()
ActiveSheet.Unprotect Password:="justme"
Application.MoveAfterReturnDirection = xlDown
End Sub


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top