ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do I hide a worksheet in Excel and use a password to un-hide . (https://www.excelbanter.com/excel-discussion-misc-queries/1000-how-do-i-hide-worksheet-excel-use-password-un-hide.html)

Dchung

How do I hide a worksheet in Excel and use a password to un-hide .
 
How do I hide a worksheet in Excel and use a password to un-hide the worksheet?

Jason Morin

To hide:

Sub Hide_Ws()
Sheets("Sheet1").Visible = xlSheetVeryHidden
End Sub

-------------

To unhide:

Sub Unhide_Ws()

Dim psword As String

psword = InputBox("Enter password to unhide worksheet.")
If psword = "" Then Exit Sub
If psword = "1234" Then
Sheets("Sheet1").Visible = True
Else
MsgBox "Incorrect password."
End If
End Sub

---
Note that when hiding the worksheet sheet, it sets it
at "veryhidden", meaning that it cannot be unhidden from
the Format menu. Password is currently set to "1234".

HTH
Jason
Atlanta, GA

-----Original Message-----
How do I hide a worksheet in Excel and use a password to

un-hide the worksheet?
.


Arvi Laanemets

Hi

Additionally, you have to protect the VBA-project with password too -
otherwise the user can activate VBA editor and change worksheets Visible
propertie manually back to xlSheetVisible witout any password.


--
Arvi Laanemets
(When sending e-mail, use address arvil<Attarkon.ee)



"Jason Morin" wrote in message
...
To hide:

Sub Hide_Ws()
Sheets("Sheet1").Visible = xlSheetVeryHidden
End Sub

-------------

To unhide:

Sub Unhide_Ws()

Dim psword As String

psword = InputBox("Enter password to unhide worksheet.")
If psword = "" Then Exit Sub
If psword = "1234" Then
Sheets("Sheet1").Visible = True
Else
MsgBox "Incorrect password."
End If
End Sub

---
Note that when hiding the worksheet sheet, it sets it
at "veryhidden", meaning that it cannot be unhidden from
the Format menu. Password is currently set to "1234".

HTH
Jason
Atlanta, GA

-----Original Message-----
How do I hide a worksheet in Excel and use a password to

un-hide the worksheet?
.




Jason Morin

Yep, you're absolutely right. Forgot to mention that.
Jason
-----Original Message-----
Hi

Additionally, you have to protect the VBA-project with

password too -
otherwise the user can activate VBA editor and change

worksheets Visible
propertie manually back to xlSheetVisible witout any

password.


--
Arvi Laanemets
(When sending e-mail, use address arvil<Attarkon.ee)



"Jason Morin" wrote

in message
...
To hide:

Sub Hide_Ws()
Sheets("Sheet1").Visible = xlSheetVeryHidden
End Sub

-------------

To unhide:

Sub Unhide_Ws()

Dim psword As String

psword = InputBox("Enter password to unhide worksheet.")
If psword = "" Then Exit Sub
If psword = "1234" Then
Sheets("Sheet1").Visible = True
Else
MsgBox "Incorrect password."
End If
End Sub

---
Note that when hiding the worksheet sheet, it sets it
at "veryhidden", meaning that it cannot be unhidden from
the Format menu. Password is currently set to "1234".

HTH
Jason
Atlanta, GA

-----Original Message-----
How do I hide a worksheet in Excel and use a password

to
un-hide the worksheet?
.



.



All times are GMT +1. The time now is 07:05 AM.

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