title: Program hangs when running (??)
body: <p>I'm creating a macro for a login screen that I'm developing to make excel a &quot;database&quot;, the following code is to check if any &quot;text boxes&quot; are empty, if the 2 &quot;text boxes&quot; are filled. , the macro will check if there is a user whose name and password are connected, but the program crashes when I run it, maybe due to the number of processes, is there a way to make this code a lighter code?</p>
  <pre><code>    Private Sub bt_seguinte_Click()
  
  Dim c As Long, usuario_verify, senha_verify
  
  usuario_verify = tb_usuario.Value
  senha_verify = tb_senha.Value
  lb_erro_usuario.Visible = False
  lb_erro_senha.Visible = False
  
  Select Case True
      
  Case Trim(usuario_verify) = &quot;&quot; And Trim(senha_verify) = &quot;&quot;
      lb_erro_usuario.Visible = True
      lb_erro_senha.Visible = True
      
  Case Trim(usuario_verify) = &quot;&quot;
      lb_erro_usuario.Visible = True
      
  Case Trim(senha_verify) = &quot;&quot;
        lb_erro_senha.Visible = True
  
  Case Else
  
  Application.ScreenUpdating = False
  
  contar_usuarios = Cells(Rows.Count, &quot;D&quot;).End(xlUp).Row
  
  For c = 1 To contar_usuarios
  
      Sheets(&quot;Usuários&quot;).Cells(1, 4).Offset(c).Select
      
      Select Case True
      
      Case ActiveCell = usuario_verify
          Exit For
      
      Case ActiveCell = contar_usuarios And ActiveCell &lt;&gt; usuario_verify
          lb_erro_usuario.Visible = True
          lb_erro_usuario.Caption = &quot;*Usuário não encontrado&quot;
      
      Case ActiveCell &lt;&gt; usuario_verify
      End Select
  
  Next c
  
  
  If lb_erro_usuario.Caption &lt;&gt; &quot;*Usuário não encontrado&quot; Then
  
  For c = 1 To contar_usuarios
  
      Sheets(&quot;Usuários&quot;).Cells(1, 5).Offset(c).Select
       
      Select Case True
      
      Case ActiveCell = senha_verify
          Exit For
      
      Case ActiveCell = contar_usuarios And ActiveCell &lt;&gt; senha_verify
          lb_erro_senha.Visible = True
          lb_erro_senha.Caption = &quot;*Senha ou Nome de Usuário incorretos&quot;
      
      Case ActiveCell &lt;&gt; senha_verify
      End Select
  Next c
  
  Else
  End If
  End Select
  
  Application.ScreenUpdating = True
  
  End Sub
  
  Private Sub UserForm_Click()
  
  End Sub
  </code></pre>