Workbook Protection Password Prompt Macro

banjoflanjo

New Member
Joined
Mar 20, 2008
Messages
44
Hi,

I have a tab that I want to remain hidden to all who do not know the password.

I want the tab to become visible via clicking a button which runs the following code

Sheets("Project Deletion Form").Visible = True

However the workbook is password protected and I would like the user to be prompted for the password once they click the button before the sheet becomes visible.

Can anyone help me with this?

Regards

Banjoflanjo
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Hi Mike,

Thanks for your reply, my code now looks like this but doesnt work:

Code:
    If LCase(Application.InputBox("Enter Password", Type:=2)) <> "password" Then Exit Sub
    Sheets("Project Deletion Form").Visible = True

Any ideas?

Banjoflanjo
 
Upvote 0
The .Visible property of a worksheet is not a Boolean value, but data type Long.
Code:
Sheets("Project Deletion Form").Visible = xlSheetVisible

Also, "openup" should be substituted for "password" in the code.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,853
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top