ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Unprotect (https://www.excelbanter.com/excel-programming/421702-unprotect.html)

Noepie

Unprotect
 
Hello,

I have a document with three sheets. One of them is hidden (standard
situation). I would like to create a button in one of the other sheets to
automatically change the property of the hidden sheet to visible when I push
the button. But the change to visible should be confirmed by a password which
is preset. If an incorrect password is entered the property of the sheet
remainds hidden. How can I achieve this?

Thanx in advance.

Noepie

Gord Dibben

Unprotect
 
Sub unhide_sht1()
pword = InputBox("Enter the password")
If pword = "qwert" Then
Sheets("Sheet1").Visible = True
Else
MsgBox "Incorrect Password"
End If
End Sub

Note: Sheet1 should be set to xlveryhidden or users can unhide simply by
FormatSheetUnhide

Lock the code from view by setting ProjectProperties to locked.


Gord Dibben MS Excel MVP


On Wed, 24 Dec 2008 09:41:01 -0800, Noepie
wrote:

Hello,

I have a document with three sheets. One of them is hidden (standard
situation). I would like to create a button in one of the other sheets to
automatically change the property of the hidden sheet to visible when I push
the button. But the change to visible should be confirmed by a password which
is preset. If an incorrect password is entered the property of the sheet
remainds hidden. How can I achieve this?

Thanx in advance.

Noepie



mikeaj72[_6_]

Unprotect
 

Noepie;158755 Wrote:
Hello,

I have a document with three sheets. One of them is hidden (standard
situation). I would like to create a button in one of the other sheets
to
automatically change the property of the hidden sheet to visible when I
push
the button. But the change to visible should be confirmed by a password
which
is preset. If an incorrect password is entered the property of the
sheet
remainds hidden. How can I achieve this?

Thanx in advance.

Noepie

You could also hide the sheet if it is visible in the same macro.
Sub unhide_sht1()
If Sheets("Sheet1").Visible = xlSheetVisible Then
Sheets("Sheet1").Visible = xlSheetVeryHidden
Else
pword = InputBox("Enter the password")
If pword = "qwert" Then
Sheets("Sheet1").Visible = xlSheetVisible
Else
MsgBox "Incorrect Password"
End If
End If
End Sub


--
mikeaj72
------------------------------------------------------------------------
mikeaj72's Profile: http://www.thecodecage.com/forumz/member.php?userid=46
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=44054



All times are GMT +1. The time now is 05:17 PM.

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