+ Reply to Thread
Results 1 to 3 of 3

command button

  1. #1
    Registered User
    Join Date
    06-27-2005
    Location
    Christchurch, NZ
    Posts
    87

    command button

    I am trying to stop the navigation and password request of a command button happening when the specified criteria are meet ==If Sheets("NMLists").Range("r5") = "NM 4" Then== . However if the criteria are not meet then i need the password and navigation function 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 Sub

  2. #2
    Rowan
    Guest

    RE: command button

    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

    "Kstalker" wrote:

    >
    > I am trying to stop the navigation and password request of a command
    > button happening when the specified criteria are meet ==If
    > Sheets("NMLists").Range("r5") = "NM 4" Then== . However if the
    > criteria are not meet then i need the password and navigation function
    > 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 Sub
    >
    >
    > --
    > Kstalker
    > ------------------------------------------------------------------------
    > Kstalker's Profile: http://www.excelforum.com/member.php...o&userid=24699
    > View this thread: http://www.excelforum.com/showthread...hreadid=386632
    >
    >


  3. #3
    Registered User
    Join Date
    06-27-2005
    Location
    Christchurch, NZ
    Posts
    87
    Thanks Rowan

    Worked exactly as I needed.

    Regards

    Kristan

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1