Can Worksheets Be Password Protected from Viewing?

bonzo

Board Regular
Joined
Oct 23, 2002
Messages
79
I know that I can hide a worksheet, but I don't want to have to keep hiding/unhiding them all of the time. Instead, I'd like to be able to see -- and anyone to which I choose to send my workbook to be able to see -- all of my worksheet tabs at the bottom of my workbook. However, I'd also like to set things up so that if someone wants to view a particular worksheet, they have to provide a password. This is not the same thing as password-protecting a worksheet from updates. This is password-protecting the ability to block viewing access to the worksheet unless a password is provided.

Put another way, let's say I have Sheet1, Sheet2, and Sheet3. Sheet1 has contact information in it. Sheet2 has URLs for reference purposes. Sheet3 has financial information that is only for certain people to be able to view. I'd like to set things up so that everyone can see that there's a Sheet1, a Sheet2, and a Sheet3. But no one can actually select and view Sheet3 without a specified password.

Is there a way to do this and if so, how is it done?

Thanks...

Bonzo
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Here's one possibility. Put it in the Sheet3 module :
Code:
Private Sub Worksheet_Activate()
Dim pw$
Application.EnableEvents = False
ActiveWindow.ScrollColumn = ActiveSheet.[XFD1].Column
Sheets("Sheet1").Activate
pw = InputBox(prompt:="Enter password to activate Sheet3")
If pw <> "Your Password" Then GoTo e
Sheets("Sheet3").Activate
ActiveWindow.ScrollColumn = ActiveSheet.[A1].Column
e: Application.EnableEvents = True
End Sub
 
Last edited:
Upvote 0
I think this is better :
Code:
Private Sub Worksheet_Activate()
Dim pw$
Application.EnableEvents = False
Sheets("Sheet1").Activate
pw = InputBox(prompt:="Enter password to activate Sheet3")
If pw <> "Your Password" Then GoTo e
Sheets("Sheet2").Activate
ActiveWindow.ScrollColumn = ActiveSheet.[A1].Column
e: Application.EnableEvents = True
End Sub


Private Sub Worksheet_Deactivate()
Dim ws As Worksheet
Set ws = ActiveSheet
Application.EnableEvents = False
Sheets("Sheet2").Activate
ActiveWindow.ScrollColumn = ActiveSheet.Columns.Count
ws.Activate
Application.EnableEvents = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,799
Messages
6,126,976
Members
449,351
Latest member
Sylvine

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