HI Team,
I have using the below code which is working fine as I have only one password "123" (Macro 1) while login into excel using user form.
However if I use multiple password with the help of OR then the macro doesn't work (Macro 2) could you please help to resolve this issue.
Macro 1 ) Working Fine with One password
Private Sub CommandButton1_Click()
If UserForm1.TextBox2.Value = "123" Then
Worksheets("Sheet1").Cells(1, 1).Value = TextBox2.Text
Unload Me
MsgBox ("Welcome !!!")
Else
Unload Me
MsgBox ("Invalid password")
UserForm1.Show
End If
End Sub
Macro 2 ) Not working with multiple passwords
Private Sub CommandButton1_Click()
If UserForm1.TextBox2.Value = "1111" Or "2222" Or "3333" Or "4444" Or "5555" Or "6666" Or "7777" Or "8888" Or "9999" Then
Worksheets("Sheet1").Cells(1, 1).Value = TextBox2.Text
Unload Me
MsgBox ("Welcome !!!")
Else
Unload Me
MsgBox ("Invalid password")
UserForm1.Show
End If
End Sub
I have using the below code which is working fine as I have only one password "123" (Macro 1) while login into excel using user form.
However if I use multiple password with the help of OR then the macro doesn't work (Macro 2) could you please help to resolve this issue.
Macro 1 ) Working Fine with One password
Private Sub CommandButton1_Click()
If UserForm1.TextBox2.Value = "123" Then
Worksheets("Sheet1").Cells(1, 1).Value = TextBox2.Text
Unload Me
MsgBox ("Welcome !!!")
Else
Unload Me
MsgBox ("Invalid password")
UserForm1.Show
End If
End Sub
Macro 2 ) Not working with multiple passwords
Private Sub CommandButton1_Click()
If UserForm1.TextBox2.Value = "1111" Or "2222" Or "3333" Or "4444" Or "5555" Or "6666" Or "7777" Or "8888" Or "9999" Then
Worksheets("Sheet1").Cells(1, 1).Value = TextBox2.Text
Unload Me
MsgBox ("Welcome !!!")
Else
Unload Me
MsgBox ("Invalid password")
UserForm1.Show
End If
End Sub