command button

K

Kstalker

I am trying to stop the navigation and password request of a comman
button happening when the specified criteria are meet ==I
Sheets("NMLists").Range("r5") = "NM 4" Then== . However if th
criteria are not meet then i need the password and navigation functio
to continue.

Help as always greatly appreciated.

Kristan

Private Sub CommandButton4_Click()
If Sheets("NMLists").Range("r5") = "NM 4" Then
Worksheets("navigation").Select
Else
End If
Set Password = Sheets("NMLists").Range("z5")
If InputBox("Please Enter the Password" _
, "Enter Password") _
<> Password Then
Sheets("Navigation").Select
Else
CommandButton4.Caption = Sheets("NMLists").Range("r5")
Worksheets("NM 4").Select
Me.Visible = True
End If
End Su
 
G

Guest

It's a little difficult to work out exactly what you are trying to do but you
might want to move the first End If down to the end of the procedure:

Private Sub CommandButton4_Click()
If Sheets("NMLists").Range("r5") = "NM 4" Then
Worksheets("navigation").Select
Else
Set Password = Sheets("NMLists").Range("z5")
If InputBox("Please Enter the Password" _
, "Enter Password") _
<> Password Then
Sheets("Navigation").Select
Else
CommandButton4.Caption = Sheets("NMLists").Range("r5")
Worksheets("NM 4").Select
Me.Visible = True
End If
End If
End Sub

Hope this helps
Rowan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

How to hide password? 1
Copy & Paste cells dependent on value 2
If/Then 3
Code optimisation 5
<1000 2
Conflict 8
If Product already exist then overwrite that row 4
Form Button vs Command Button 2

Top