title: How to make a dynamic log in userform in vba
body: <p>I want to make a login UserForm that the credentials will loop in a range in cells. the name of my worksheet containing the credentials is "Admin"</p>
  
  <p>This the code I made but it is a hardcoded one </p>
  
  <pre><code>Private Sub CommandButton1_Click()
  
  If TextBox1.Text = "Admin" And TextBox2.Text = "Admin123" Then
      Sheets("Interface").Select
      Sheets("Menu").Visible = True
      ActiveWindow.SelectedSheets.Visible = False
      Sheets("Menu").Select
      Sheet6.User.Enabled = True
  ElseIf TextBox1.Text = "User" And TextBox2.Text = "User123" Then
      Sheets("Interface").Select
      Sheets("Menu").Visible = True
      ActiveWindow.SelectedSheets.Visible = False
      Sheets("Menu").Select
      Sheet6.User.Enabled = False
  End If
  
  End Sub
  </code></pre>
  
  <p>I am expecting to have a dynamic log in form having its credentials in a worksheet</p>