Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Protecting Multiple sheets with prompt for password to unprotect

Subject pretty much says it all, I need to be able to protect & unprotect 31 sheets in a workbook, but I also need it to ask for a password to unprotect.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Protecting Multiple sheets with prompt for password to unprotect


Sub drinkme()
Dim wks As Worksheet

For Each wks In ThisWorkbook.Worksheets
wks.Protect "mypassword"
Next
End Sub

Sub eatme()
Dim wks As Worksheet, strPassword As String, blnError As Boolean

strPassword = InputBox("What's the password?")
If strPassword = "" Then Exit Sub
On Error Resume Next
blnError = False
For Each wks In ThisWorkbook.Worksheets
wks.Unprotect strPassword
If Err Then
MsgBox "Password incorrect", vbExclamation
blnError = True
Exit For
End If
Next
If Not blnError Then MsgBox "Done!", vbInformation
End Sub

Rob


"pkley" wrote in message
...
Subject pretty much says it all, I need to be able to protect & unprotect

31 sheets in a workbook, but I also need it to ask for a password to
unprotect.


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 multiple spreadsheets at once Ron Excel Discussion (Misc queries) 4 August 26th 08 09:19 PM
I forget the password of protecting sheet, I need to unprotect it khalid[_2_] Excel Discussion (Misc queries) 1 November 17th 07 09:55 AM
Password protecting sheets in a workbook Les[_2_] Excel Worksheet Functions 4 February 24th 07 06:38 PM
How do I unprotect multiple sheets simultaneously? ExcelPC Excel Discussion (Misc queries) 3 August 28th 06 11:15 PM
Password Protecting Sheets in Excel So Others Can't See Certain Sh _ian2006_ Excel Worksheet Functions 3 February 23rd 06 05:38 PM


All times are GMT +1. The time now is 08:14 AM.

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"