PDA

View Full Version : User Form - Many Text Boxes - Restrict One Text Box with Password for Editing



kavi
12-06-2019, 02:50 AM
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

paulked
12-07-2019, 04:00 AM
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