password protecting

B4L4KS

Board Regular
Joined
Mar 7, 2011
Messages
69
hi

i know how to password protect a document and cells, but is there a way of password protecting a page so a user cant enter the page, not even look at the page without having to enter a password,

also can it be assigned to a hyper-link/ macro

many thanks

kristian
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Jaafar Tribak

Well-known Member
Joined
Dec 5, 2002
Messages
8,618
Office Version
  1. 2016
Platform
  1. Windows
hi

i know how to password protect a document and cells, but is there a way of password protecting a page so a user cant enter the page, not even look at the page without having to enter a password,

also can it be assigned to a hyper-link/ macro

many thanks

kristian

You can make the Sheet very hidden (xlSheetVeryHidden) via the worksheet module Property window in the VBE. Then you can code the opening of the sheet to propmpt the user for a password.
 

Simon Lloyd

Well-known Member
Joined
Sep 10, 2006
Messages
756
You need to create a userform with a command button and textbox on it, change the textbox properties "PasswordChar" for whatever you would like to see instead of the actual text, add this code to the commandbutton
Code:
Private Sub CommandButton1_Click()
If Me.TextBox1.Value <> "password" Then
Sheets("Sheet1").Select
End If
Unload Me
End Sub
add this code to the thisworkbook code module
Code:
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
'check if it's the first sheet
If ActiveSheet.Name = "Sheet1" Then Exit Sub
'check system for your login name
If Environ("username") = "your username here" Then Exit Sub
UserForm1.Show
End Sub

It's just a quickly knocked up thing and there is much more you can do for multiple access....etc but it does mean that they must have macros enabled.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,683
Messages
5,838,792
Members
430,569
Latest member
sbardelli

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
Top