ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Macro to Unprotect sheet!? (https://www.excelbanter.com/excel-worksheet-functions/79462-macro-unprotect-sheet.html)

Neo1

Macro to Unprotect sheet!?
 

Hello I'm quite stuck, I'm trying to create a macro while the worksheet
is protected and the thing is i click unprotect and the password
dialogue box appears asking me to enter password which is fine, but can
i create a macro so that when it is played it opens this dialogue box
for me to enter password to unprotect sheet?

Thanks a lot
From John


--
Neo1
------------------------------------------------------------------------
Neo1's Profile: http://www.excelforum.com/member.php...o&userid=30329
View this thread: http://www.excelforum.com/showthread...hreadid=526090


swatsp0p

Macro to Unprotect sheet!?
 

try this:


Code:
--------------------
Sub Unprotect sheet()
'Private Sub CommandButton1_Click()

' unprotect Macro

ActiveSheet.unprotect

End Sub
--------------------


If you want to assign this to a button, uncomment the Private Sub line
and comment out (or remove) the Sub line.

HTH

Bruce


--
swatsp0p


------------------------------------------------------------------------
swatsp0p's Profile: http://www.excelforum.com/member.php...o&userid=15101
View this thread: http://www.excelforum.com/showthread...hreadid=526090


Neo1

Macro to Unprotect sheet!?
 

I dont understand ...what do you mean?

do i need to use VB code for it?

Thanks a lot
From John


--
Neo1
------------------------------------------------------------------------
Neo1's Profile: http://www.excelforum.com/member.php...o&userid=30329
View this thread: http://www.excelforum.com/showthread...hreadid=526090


Neo1

Macro to Unprotect sheet!?
 

Any help to create a macro to unprotect worksheet but before it does to
pop up the dialogue box asking user to enter password to unprotect
worksheet?

I need help pleasee
Thanks a lot
From John


--
Neo1
------------------------------------------------------------------------
Neo1's Profile: http://www.excelforum.com/member.php...o&userid=30329
View this thread: http://www.excelforum.com/showthread...hreadid=526090


Desert Piranha

Macro to Unprotect sheet!?
 

Neo1 Wrote:
Any help to create a macro to unprotect worksheet but before it does to
pop up the dialogue box asking user to enter password to unprotect
worksheet?

I need help pleasee
Thanks a lot
From JohnHi Neo1,


It sounds like you want the sheet to automaticaly unprotect with a
password.
If this is so, Just add to Bruce's code for the password.

Put this in the Module for the sheet in question.
Right Click on the worksheet tab and select "View Code".
Paste the folowing code there. Don't forget to replace your password
where it says "your password goes here"

Private Sub Worksheet_Activate()
ActiveSheet.Unprotect Password:=your password goes here
End Sub

Same thing without a password:

Private Sub Worksheet_Activate()
ActiveSheet.Unprotect
End Sub


--
Desert Piranha


------------------------------------------------------------------------
Desert Piranha's Profile: http://www.excelforum.com/member.php...o&userid=28934
View this thread: http://www.excelforum.com/showthread...hreadid=526090


Neo1

Macro to Unprotect sheet!?
 

yeah ok thanks...but how do i apply it to a button so that whenever i
need to click the unprotect button for the sheet....

and also how can i make it so that each worksheet has a different
password to unprotect it?

Thanks a lot
From John


--
Neo1
------------------------------------------------------------------------
Neo1's Profile: http://www.excelforum.com/member.php...o&userid=30329
View this thread: http://www.excelforum.com/showthread...hreadid=526090



All times are GMT +1. The time now is 09:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com