Protect cells function

G

Guest

I have the following code that unprotects a sheet and a workbook.

On Error GoTo errorHandler
ActiveSheet.Unprotect 'Unprotects the
sheet: Menu
ActiveWorkbook.Unprotect (123) 'Unprotects the
workbook Sheets("InternalMenu").Visible = True 'Unhides
sheet: Internal Menu
Sheets("JobSheet").Visible = True

Exit Sub
On Error GoTo 0
errorHandler:
MsgBox "The Password you have supplied is incorrect. Please verify that you
have the correct capitilistation."

The trouble is that when you are prompted for the password to unprotect the
sheet, if you press cancel, the code still runs.

How can I manage the cancel button on the Password prompt box to actually
exit the sub when cancel is pressed.

I have tried if unprotect = vbCancel then exit sub, and varaiations of this,
but to no envail.

Can anyone help?

Thanks,

Pinda
 
G

Guest

Where are you prompting for the password? Seems like there is some code
missing here.
 
G

Guest

Hi,

ActiveSheet.Unprotect prompts the password, since no password is entered in
brackets.

Can anyone help?

Bhupinder.
 

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