Consulting

Results 1 to 2 of 2

Thread: User Form - Many Text Boxes - Restrict One Text Box with Password for Editing

  1. #1
    VBAX Newbie
    Joined
    Dec 2019
    Posts
    1
    Location

    User Form - Many Text Boxes - Restrict One Text Box with Password for Editing

    Dear Friends,

    I have created Userform with may Textboxes.

    In that Textboxes only one textbox to be restricted with password.

    If we need to edit that textbox it should ask for password.

    Also whatever we write in that textboox it should be copied to Sheet1 ("C5").

    Please help

  2. #2
    VBAX Master paulked's Avatar
    Joined
    Apr 2006
    Posts
    1,007
    Location
    Private Sub TextBox2_Enter()
        Dim sPW As String
        sPW = InputBox("Please enter the password...", "Password needed...")
        If sPW <> "3j9l^k564x$2w5m9u" Then TextBox1.SetFocus: Exit Sub
        MsgBox "You're in!"
    End Sub
    
    
    Private Sub TextBox2_Exit(ByVal Cancel As MSForms.ReturnBoolean)
        Sheet1.Range("C5") = TextBox2
    End Sub
    Or use Private Sub TextBox2_AfterUpdate() for writing to the sheet
    Semper in excretia sumus; solum profundum variat.

Posting Permissions

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