PDA

View Full Version : [SOLVED:] Unhiding multiple sheet based on choice prompted after entering password



paradise
10-10-2013, 01:07 AM
Hi,
Currently I do have a two problem.First problem is regarding the password.When I enter the password,it displays the character instead of hiding the character by " * ".Below is the code.


Option Explicit
Option Compare Text
'Password to unhide sheets
Const pWord = "suresh"

Secondly,I have used a macro to hide all the sheets except exisiting/current sheet.It works very well.Now when I use macro to unhide the sheet by using below mentioned vba code,it prompt me to ask password which is in above vba code given & displays only specific sheet which I have mentioned in the code.Now what I want is that I want to get modify my code in such a way that it asks me which which sheet you want to get unhide instead of a single sheet.Below is the vba code-


Sub HideSheets()
'Set worksheet to Very Hidden so that it can only be unhidden by a macro
Dim i As Integer
For i = 1 To Sheets.Count
If Sheets(i).Name <> "List" Then Sheets(i).Visible = False
Next i
End Sub


Sub ShowSheets()
'Prompt the user for a password and unhide the worksheet if correct
Select Case InputBox("Please enter the password", _
"Enter Password")

Case Is = pWord
With Worksheets("pgwise")
.Visible = xlSheetVisible
.Activate
.Range("A1").Select
End With
Case Else
MsgBox "Sorry, that password is incorrect!", _
vbCritical + vbOKOnly, "You are not authorized!"
End Select
End Sub

Hope, you have understood well.If you require any further info,pls do let me know.Also,I am a learner which just has started learning from this website.

With Best Rgds,
suresh

p45cal
10-10-2013, 05:45 AM
For the first part of your question see:
http://www.ozgrid.com/VBA/excel-worksheet-protect-all.htm
http://www.ozgrid.com/forum/showthread.php?t=72794
http://www.mrexcel.com/forum/excel-questions/43144-inputbox-password.html

p45cal
10-10-2013, 07:32 AM
For the second part of your question see attached.
At the moment it unhides one sheet at a time, it will need tweaking to multiselect sheets for unhiding.

paradise
10-10-2013, 09:53 PM
Dear Sir,

I have seen the attachment.It allows me to select only one at time.And again after opening,I have to come back and again click on the button to select another one.Is there not a way to display all the worksheet list with the options for selecting one or two or many sheet from the dialogue box.

With Best Rgds,
Suresh

p45cal
10-10-2013, 10:38 PM
I did point this out
At the moment it unhides one sheet at a time, it will need tweaking to multiselect sheets for unhiding.
See attached.
10686

paradise
10-10-2013, 10:57 PM
ok,
Thanks.