Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Protecting sheets in excel using macros 1

Status
Not open for further replies.

springy2003

Instructor
Jan 30, 2003
67
GB
Hi, I am sure this can be done. I want to be able to protect a sheet, and at the same time, using a password. The current macro I have is as follows

Sub Protect()
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub

but the thing is, it only protects the sheets, but it doesn't use a password. Is there anyway to bring up a box so that a user can type in their own password. Thanks so much!
 
[idea]uhhh ... could be this little Excel xla I've been reading about
(apparently it's packed full of fun utils like
Code:
TurnErrorMessageIntoCrappyCommentToConfuseProgrammer(Err As Error)
)

apart from that - let me get home, grab a bite, think, fall asleep on the couch again, watch some CL matches (yay for Ajax ;-))
[cannon] & something might hit me

Cheers
Nikki
 
Kudos to Ajax for last night's performance - that'll shut the gooners up for a bit :) Rgds
Geoff

Vah! Denuone Latine loquebar? Me ineptum. Interdum modo elabitur
 
my (English) boss is an Arsenal fan
but we're pleased anyway


Cheers
Nikki
 
Mmmm Ajax
Very impressive. Hope we can go one better in the cup tho' against those gooners!!

Juve tonight!
;-) If a man says something and there are no women there to hear him, is he still wrong? [ponder]
 

The password is in quotes. Here are some examples to a sheet and a workbook.

Sub Unprotect_Workbook()
ActiveWorkbook.Unprotect "lloyd"
end sub


Sub Protect_Workbook()
ActiveWorkbook.Protect "lloyd"
end sub

Sub Unprotect_worksheet()
Sheets("Main").Unprotect "wright"
end sub

Sub Protect_worksheet()
Sheets("Main").Protect "wright"
end sub


Hope they help
Todd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top