Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Password to Unhide VeryHidden Sheets

Code is not working; must be due to the If...Then. I'm tired now and can't
see the error in the logic. Can someone point out the mistake?


Private Sub CommandButton1_Click()
Dim i_pwd As String
Dim pwd As String
'#1
If pwd = "showandy" Then
i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
Select Case i_pwd
Case pwd
Worksheets("Andy").Visible = True
Sheets("Andy").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, "Unhide
Sheet..."
End Select
End If
Exit Sub


'#2
If pwd = "showchris" Then
i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
Select Case i_pwd
Case pwd
Worksheets("Chris").Visible = True
Sheets("Chris").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, "Unhide
Sheet..."
End Select
End If
Exit Sub


'#3
If pwd = "showdavid" Then
i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
Select Case i_pwd
Case pwd
Worksheets("David").Visible = True
Sheets("David").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, "Unhide
Sheet..."
End Select
End If
Exit Sub
End Sub

Regards,
Ryan---

--
RyGuy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Password to Unhide VeryHidden Sheets

Maybe...

Private Sub CommandButton1_Click()
Dim i_pwd As String

i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
if i_pwd = "" then
exit sub
end if

Select Case lcase(i_pwd)
Case is = "showandy"
Worksheets("Andy").Visible = True
Sheets("Andy").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, _
"Unhide Sheet..."
End Select

Exit Sub

(Untested, uncompiled.)

ryguy7272 wrote:

Code is not working; must be due to the If...Then. I'm tired now and can't
see the error in the logic. Can someone point out the mistake?

Private Sub CommandButton1_Click()
Dim i_pwd As String
Dim pwd As String
'#1
If pwd = "showandy" Then
i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
Select Case i_pwd
Case pwd
Worksheets("Andy").Visible = True
Sheets("Andy").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, "Unhide
Sheet..."
End Select
End If
Exit Sub

'#2
If pwd = "showchris" Then
i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
Select Case i_pwd
Case pwd
Worksheets("Chris").Visible = True
Sheets("Chris").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, "Unhide
Sheet..."
End Select
End If
Exit Sub

'#3
If pwd = "showdavid" Then
i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
Select Case i_pwd
Case pwd
Worksheets("David").Visible = True
Sheets("David").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, "Unhide
Sheet..."
End Select
End If
Exit Sub
End Sub

Regards,
Ryan---

--
RyGuy


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 68
Default Password to Unhide VeryHidden Sheets

On Jun 4, 3:03*am, Dave Peterson wrote:
Maybe...

Private Sub CommandButton1_Click()
Dim i_pwd As String

i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet....")
if i_pwd = "" then
* exit sub
end if

Select Case lcase(i_pwd)
* *Case is = "showandy"
* * * * Worksheets("Andy").Visible = True
* * * * Sheets("Andy").Select
* *Case Else
* * * * MsgBox "Incorrect password; no action taken.", vbInformation, _
* * * * * * *"Unhide Sheet..."
End Select

Exit Sub

(Untested, uncompiled.)





ryguy7272 wrote:

Code is not working; must be due to the If...Then. *I'm tired now and can't
see the error in the logic. *Can someone point out the mistake?


Private Sub CommandButton1_Click()
Dim i_pwd As String
Dim pwd As String
'#1
If pwd = "showandy" Then
i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
Select Case i_pwd
Case pwd
Worksheets("Andy").Visible = True
Sheets("Andy").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, "Unhide
Sheet..."
End Select
End If
Exit Sub


'#2
If pwd = "showchris" Then
i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
Select Case i_pwd
Case pwd
Worksheets("Chris").Visible = True
Sheets("Chris").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, "Unhide
Sheet..."
End Select
End If
Exit Sub


'#3
If pwd = "showdavid" Then
i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
Select Case i_pwd
Case pwd
Worksheets("David").Visible = True
Sheets("David").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, "Unhide
Sheet..."
End Select
End If
Exit Sub
End Sub


Regards,
Ryan---


--
RyGuy


--

Dave Peterson- Hide quoted text -

- Show quoted text -




Sorry to jumping in your thread.

your code is working perfect, but when input box is appearing and
asking for password, when you type anything, it is appearing alphabet,
i.e. showandy.

is there any way to change cheractors to ********** (STARIC), so
no one can see what is the password has entered.

Best regards.
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Password to Unhide VeryHidden Sheets

Not using an inputbox.

You could design your own userform and hide the characters, though.

wrote:

On Jun 4, 3:03 am, Dave Peterson wrote:
Maybe...

Private Sub CommandButton1_Click()
Dim i_pwd As String

i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
if i_pwd = "" then
exit sub
end if

Select Case lcase(i_pwd)
Case is = "showandy"
Worksheets("Andy").Visible = True
Sheets("Andy").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, _
"Unhide Sheet..."
End Select

Exit Sub

(Untested, uncompiled.)





ryguy7272 wrote:

Code is not working; must be due to the If...Then. I'm tired now and can't
see the error in the logic. Can someone point out the mistake?


Private Sub CommandButton1_Click()
Dim i_pwd As String
Dim pwd As String
'#1
If pwd = "showandy" Then
i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
Select Case i_pwd
Case pwd
Worksheets("Andy").Visible = True
Sheets("Andy").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, "Unhide
Sheet..."
End Select
End If
Exit Sub


'#2
If pwd = "showchris" Then
i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
Select Case i_pwd
Case pwd
Worksheets("Chris").Visible = True
Sheets("Chris").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, "Unhide
Sheet..."
End Select
End If
Exit Sub


'#3
If pwd = "showdavid" Then
i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
Select Case i_pwd
Case pwd
Worksheets("David").Visible = True
Sheets("David").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, "Unhide
Sheet..."
End Select
End If
Exit Sub
End Sub


Regards,
Ryan---


--
RyGuy


--

Dave Peterson- Hide quoted text -

- Show quoted text -


Sorry to jumping in your thread.

your code is working perfect, but when input box is appearing and
asking for password, when you type anything, it is appearing alphabet,
i.e. showandy.

is there any way to change cheractors to ********** (STARIC), so
no one can see what is the password has entered.

Best regards.


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Password to Unhide VeryHidden Sheets

Thanks everyone!! There still appears to be a problem though (and I am not
tired anymore). I went with Dave's suggestion and modified the code
slightly; it now looks like this:
Private Sub CommandButton1_Click()
Dim i_pwd As String

i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
If i_pwd = "" Then
Exit Sub
End If
Select Case LCase(i_pwd)
Case Is = "showjim"
Worksheets("Jim").Visible = True
Sheets("Jim").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, _
"Unhide Sheet..."
End Select
Exit Sub


i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
If i_pwd = "" Then
Exit Sub
End If
Select Case LCase(i_pwd)
Case Is = "showkari"
Worksheets("Kari").Visible = True
Sheets("Kari").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, _
"Unhide Sheet..."
End Select
Exit Sub


i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
If i_pwd = "" Then
Exit Sub
End If
Select Case LCase(i_pwd)
Case Is = "showlee"
Worksheets("Lee").Visible = True
Sheets("Lee").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, _
"Unhide Sheet..."
End Select

Exit Sub


End Sub


The problem is as follows. If I enter Jim's password, 'showjim' the code
works fine, and Jim's Sheet is displayed. If I try to use one of the other
two passwords, neither page is displayed. It has something to do with the
loop; Jim comes first in the code and so the macro seems to recognize this
but nothing else. Anyone see the problem?

As always, thanks a ton!!
Ryan---

--
RyGuy


"Dave Peterson" wrote:

Not using an inputbox.

You could design your own userform and hide the characters, though.

wrote:

On Jun 4, 3:03 am, Dave Peterson wrote:
Maybe...

Private Sub CommandButton1_Click()
Dim i_pwd As String

i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
if i_pwd = "" then
exit sub
end if

Select Case lcase(i_pwd)
Case is = "showandy"
Worksheets("Andy").Visible = True
Sheets("Andy").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, _
"Unhide Sheet..."
End Select

Exit Sub

(Untested, uncompiled.)





ryguy7272 wrote:

Code is not working; must be due to the If...Then. I'm tired now and can't
see the error in the logic. Can someone point out the mistake?

Private Sub CommandButton1_Click()
Dim i_pwd As String
Dim pwd As String
'#1
If pwd = "showandy" Then
i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
Select Case i_pwd
Case pwd
Worksheets("Andy").Visible = True
Sheets("Andy").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, "Unhide
Sheet..."
End Select
End If
Exit Sub

'#2
If pwd = "showchris" Then
i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
Select Case i_pwd
Case pwd
Worksheets("Chris").Visible = True
Sheets("Chris").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, "Unhide
Sheet..."
End Select
End If
Exit Sub

'#3
If pwd = "showdavid" Then
i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
Select Case i_pwd
Case pwd
Worksheets("David").Visible = True
Sheets("David").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, "Unhide
Sheet..."
End Select
End If
Exit Sub
End Sub

Regards,
Ryan---

--
RyGuy

--

Dave Peterson- Hide quoted text -

- Show quoted text -


Sorry to jumping in your thread.

your code is working perfect, but when input box is appearing and
asking for password, when you type anything, it is appearing alphabet,
i.e. showandy.

is there any way to change cheractors to ********** (STARIC), so
no one can see what is the password has entered.

Best regards.


--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Password to Unhide VeryHidden Sheets

Option Explicit
Private Sub CommandButton1_Click()
Dim i_pwd As String

i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
If i_pwd = "" Then
Exit Sub
End If

Select Case LCase(i_pwd)
Case Is = "showandy"
Worksheets("Andy").Visible = True
Sheets("Andy").Select

Case Is = "showkari"
Worksheets("Kari").Visible = True
Sheets("Kari").Select

Case Is = "showlee"
Worksheets("Lee").Visible = True
Sheets("Lee").Select

Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, _
"Unhide Sheet..."
End Select

Exit Sub



ryguy7272 wrote:

Thanks everyone!! There still appears to be a problem though (and I am not
tired anymore). I went with Dave's suggestion and modified the code
slightly; it now looks like this:
Private Sub CommandButton1_Click()
Dim i_pwd As String

i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
If i_pwd = "" Then
Exit Sub
End If
Select Case LCase(i_pwd)
Case Is = "showjim"
Worksheets("Jim").Visible = True
Sheets("Jim").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, _
"Unhide Sheet..."
End Select
Exit Sub

i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
If i_pwd = "" Then
Exit Sub
End If
Select Case LCase(i_pwd)
Case Is = "showkari"
Worksheets("Kari").Visible = True
Sheets("Kari").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, _
"Unhide Sheet..."
End Select
Exit Sub

i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
If i_pwd = "" Then
Exit Sub
End If
Select Case LCase(i_pwd)
Case Is = "showlee"
Worksheets("Lee").Visible = True
Sheets("Lee").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, _
"Unhide Sheet..."
End Select

Exit Sub

End Sub

The problem is as follows. If I enter Jim's password, 'showjim' the code
works fine, and Jim's Sheet is displayed. If I try to use one of the other
two passwords, neither page is displayed. It has something to do with the
loop; Jim comes first in the code and so the macro seems to recognize this
but nothing else. Anyone see the problem?

As always, thanks a ton!!
Ryan---

--
RyGuy

"Dave Peterson" wrote:

Not using an inputbox.

You could design your own userform and hide the characters, though.

wrote:

On Jun 4, 3:03 am, Dave Peterson wrote:
Maybe...

Private Sub CommandButton1_Click()
Dim i_pwd As String

i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
if i_pwd = "" then
exit sub
end if

Select Case lcase(i_pwd)
Case is = "showandy"
Worksheets("Andy").Visible = True
Sheets("Andy").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, _
"Unhide Sheet..."
End Select

Exit Sub

(Untested, uncompiled.)





ryguy7272 wrote:

Code is not working; must be due to the If...Then. I'm tired now and can't
see the error in the logic. Can someone point out the mistake?

Private Sub CommandButton1_Click()
Dim i_pwd As String
Dim pwd As String
'#1
If pwd = "showandy" Then
i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
Select Case i_pwd
Case pwd
Worksheets("Andy").Visible = True
Sheets("Andy").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, "Unhide
Sheet..."
End Select
End If
Exit Sub

'#2
If pwd = "showchris" Then
i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
Select Case i_pwd
Case pwd
Worksheets("Chris").Visible = True
Sheets("Chris").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, "Unhide
Sheet..."
End Select
End If
Exit Sub

'#3
If pwd = "showdavid" Then
i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
Select Case i_pwd
Case pwd
Worksheets("David").Visible = True
Sheets("David").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, "Unhide
Sheet..."
End Select
End If
Exit Sub
End Sub

Regards,
Ryan---

--
RyGuy

--

Dave Peterson- Hide quoted text -

- Show quoted text -

Sorry to jumping in your thread.

your code is working perfect, but when input box is appearing and
asking for password, when you type anything, it is appearing alphabet,
i.e. showandy.

is there any way to change cheractors to ********** (STARIC), so
no one can see what is the password has entered.

Best regards.


--

Dave Peterson


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Password to Unhide VeryHidden Sheets

That's it!! Thanks so much Dave!! One more thing, it probably makes sense
to store the code in a Module, as opposed to the Sheet, right. The code in
the Module can be protected with a password itself, but the sheet can't. I
mean, a user can simply right-click and see the Sheet code, right.

Regards,
Ryan---

--
RyGuy


"Dave Peterson" wrote:

Option Explicit
Private Sub CommandButton1_Click()
Dim i_pwd As String

i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
If i_pwd = "" Then
Exit Sub
End If

Select Case LCase(i_pwd)
Case Is = "showandy"
Worksheets("Andy").Visible = True
Sheets("Andy").Select

Case Is = "showkari"
Worksheets("Kari").Visible = True
Sheets("Kari").Select

Case Is = "showlee"
Worksheets("Lee").Visible = True
Sheets("Lee").Select

Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, _
"Unhide Sheet..."
End Select

Exit Sub



ryguy7272 wrote:

Thanks everyone!! There still appears to be a problem though (and I am not
tired anymore). I went with Dave's suggestion and modified the code
slightly; it now looks like this:
Private Sub CommandButton1_Click()
Dim i_pwd As String

i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
If i_pwd = "" Then
Exit Sub
End If
Select Case LCase(i_pwd)
Case Is = "showjim"
Worksheets("Jim").Visible = True
Sheets("Jim").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, _
"Unhide Sheet..."
End Select
Exit Sub

i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
If i_pwd = "" Then
Exit Sub
End If
Select Case LCase(i_pwd)
Case Is = "showkari"
Worksheets("Kari").Visible = True
Sheets("Kari").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, _
"Unhide Sheet..."
End Select
Exit Sub

i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
If i_pwd = "" Then
Exit Sub
End If
Select Case LCase(i_pwd)
Case Is = "showlee"
Worksheets("Lee").Visible = True
Sheets("Lee").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, _
"Unhide Sheet..."
End Select

Exit Sub

End Sub

The problem is as follows. If I enter Jim's password, 'showjim' the code
works fine, and Jim's Sheet is displayed. If I try to use one of the other
two passwords, neither page is displayed. It has something to do with the
loop; Jim comes first in the code and so the macro seems to recognize this
but nothing else. Anyone see the problem?

As always, thanks a ton!!
Ryan---

--
RyGuy

"Dave Peterson" wrote:

Not using an inputbox.

You could design your own userform and hide the characters, though.

wrote:

On Jun 4, 3:03 am, Dave Peterson wrote:
Maybe...

Private Sub CommandButton1_Click()
Dim i_pwd As String

i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
if i_pwd = "" then
exit sub
end if

Select Case lcase(i_pwd)
Case is = "showandy"
Worksheets("Andy").Visible = True
Sheets("Andy").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, _
"Unhide Sheet..."
End Select

Exit Sub

(Untested, uncompiled.)





ryguy7272 wrote:

Code is not working; must be due to the If...Then. I'm tired now and can't
see the error in the logic. Can someone point out the mistake?

Private Sub CommandButton1_Click()
Dim i_pwd As String
Dim pwd As String
'#1
If pwd = "showandy" Then
i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
Select Case i_pwd
Case pwd
Worksheets("Andy").Visible = True
Sheets("Andy").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, "Unhide
Sheet..."
End Select
End If
Exit Sub

'#2
If pwd = "showchris" Then
i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
Select Case i_pwd
Case pwd
Worksheets("Chris").Visible = True
Sheets("Chris").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, "Unhide
Sheet..."
End Select
End If
Exit Sub

'#3
If pwd = "showdavid" Then
i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
Select Case i_pwd
Case pwd
Worksheets("David").Visible = True
Sheets("David").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, "Unhide
Sheet..."
End Select
End If
Exit Sub
End Sub

Regards,
Ryan---

--
RyGuy

--

Dave Peterson- Hide quoted text -

- Show quoted text -

Sorry to jumping in your thread.

your code is working perfect, but when input box is appearing and
asking for password, when you type anything, it is appearing alphabet,
i.e. showandy.

is there any way to change cheractors to ********** (STARIC), so
no one can see what is the password has entered.

Best regards.

--

Dave Peterson


--

Dave Peterson

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Password to Unhide VeryHidden Sheets

If you protect the project within the VBE, then the code in a general module or
behind the worksheet or anywhere else in that project will have the same
protection.

And since this code is associated with that commandbutton on the the worksheet,
it belongs behind that worksheet.

Try protecting the project, then save, close and reopen the workbook. Then try
to view your code.


ryguy7272 wrote:

That's it!! Thanks so much Dave!! One more thing, it probably makes sense
to store the code in a Module, as opposed to the Sheet, right. The code in
the Module can be protected with a password itself, but the sheet can't. I
mean, a user can simply right-click and see the Sheet code, right.

Regards,
Ryan---

--
RyGuy

"Dave Peterson" wrote:

Option Explicit
Private Sub CommandButton1_Click()
Dim i_pwd As String

i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
If i_pwd = "" Then
Exit Sub
End If

Select Case LCase(i_pwd)
Case Is = "showandy"
Worksheets("Andy").Visible = True
Sheets("Andy").Select

Case Is = "showkari"
Worksheets("Kari").Visible = True
Sheets("Kari").Select

Case Is = "showlee"
Worksheets("Lee").Visible = True
Sheets("Lee").Select

Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, _
"Unhide Sheet..."
End Select

Exit Sub



ryguy7272 wrote:

Thanks everyone!! There still appears to be a problem though (and I am not
tired anymore). I went with Dave's suggestion and modified the code
slightly; it now looks like this:
Private Sub CommandButton1_Click()
Dim i_pwd As String

i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
If i_pwd = "" Then
Exit Sub
End If
Select Case LCase(i_pwd)
Case Is = "showjim"
Worksheets("Jim").Visible = True
Sheets("Jim").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, _
"Unhide Sheet..."
End Select
Exit Sub

i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
If i_pwd = "" Then
Exit Sub
End If
Select Case LCase(i_pwd)
Case Is = "showkari"
Worksheets("Kari").Visible = True
Sheets("Kari").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, _
"Unhide Sheet..."
End Select
Exit Sub

i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
If i_pwd = "" Then
Exit Sub
End If
Select Case LCase(i_pwd)
Case Is = "showlee"
Worksheets("Lee").Visible = True
Sheets("Lee").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, _
"Unhide Sheet..."
End Select

Exit Sub

End Sub

The problem is as follows. If I enter Jim's password, 'showjim' the code
works fine, and Jim's Sheet is displayed. If I try to use one of the other
two passwords, neither page is displayed. It has something to do with the
loop; Jim comes first in the code and so the macro seems to recognize this
but nothing else. Anyone see the problem?

As always, thanks a ton!!
Ryan---

--
RyGuy

"Dave Peterson" wrote:

Not using an inputbox.

You could design your own userform and hide the characters, though.

wrote:

On Jun 4, 3:03 am, Dave Peterson wrote:
Maybe...

Private Sub CommandButton1_Click()
Dim i_pwd As String

i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
if i_pwd = "" then
exit sub
end if

Select Case lcase(i_pwd)
Case is = "showandy"
Worksheets("Andy").Visible = True
Sheets("Andy").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, _
"Unhide Sheet..."
End Select

Exit Sub

(Untested, uncompiled.)





ryguy7272 wrote:

Code is not working; must be due to the If...Then. I'm tired now and can't
see the error in the logic. Can someone point out the mistake?

Private Sub CommandButton1_Click()
Dim i_pwd As String
Dim pwd As String
'#1
If pwd = "showandy" Then
i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
Select Case i_pwd
Case pwd
Worksheets("Andy").Visible = True
Sheets("Andy").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, "Unhide
Sheet..."
End Select
End If
Exit Sub

'#2
If pwd = "showchris" Then
i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
Select Case i_pwd
Case pwd
Worksheets("Chris").Visible = True
Sheets("Chris").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, "Unhide
Sheet..."
End Select
End If
Exit Sub

'#3
If pwd = "showdavid" Then
i_pwd = InputBox("Please Enter Password to Unhide Sheet", "Unhide Sheet...")
Select Case i_pwd
Case pwd
Worksheets("David").Visible = True
Sheets("David").Select
Case Else
MsgBox "Incorrect password; no action taken.", vbInformation, "Unhide
Sheet..."
End Select
End If
Exit Sub
End Sub

Regards,
Ryan---

--
RyGuy

--

Dave Peterson- Hide quoted text -

- Show quoted text -

Sorry to jumping in your thread.

your code is working perfect, but when input box is appearing and
asking for password, when you type anything, it is appearing alphabet,
i.e. showandy.

is there any way to change cheractors to ********** (STARIC), so
no one can see what is the password has entered.

Best regards.

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unhide All VeryHidden Sheets in a workbook (w/o naming them) J.W. Aldridge Excel Programming 1 October 4th 07 04:16 PM
Please help me find veryhidden sheets J.W. Aldridge Excel Programming 1 September 26th 07 03:25 PM
Validation OK to named ranges in Veryhidden sheets? tskogstrom Excel Programming 8 June 5th 07 11:41 AM
Password to hide and unhide sheets Veera Excel Programming 2 July 23rd 03 04:23 PM
Password to hide and unhide sheets Patrick Molloy Excel Programming 0 July 23rd 03 04:04 PM


All times are GMT +1. The time now is 02:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"