title: If Else not being recognized
body: <p>I have a form in which the user inputs a number, and I want my macro to check whether the number exists in a specific list in order to do some stuff. Here's how I did it:</p>
  
  <pre><code>Private Sub CommandButton3_Click()
   Dim number As Integer, i As Integer
   For i = 10 To 10020
       If TextBox1.Value = Sheet1.Cells(i, 2).Value Then
           number = TextBox1.Value
       End If
   Next i
       MsgBox "A dica número " &amp; TextBox1.Value &amp; " não consta na lista.", vbOKOnly, "Dica não encontrada!"
       Exit Sub
  
   'Do the rest of the code here
  End Sub
  </code></pre>
  
  <p>The thing is: no matter what number I input, the message box always comes up. <code>number = TextBox1.Value</code> is never read.
  I've tried manually checking if the values were the same for a specific input with message boxes, and even though they were the same, If/Else was never accessed.</p>
  
  <p>Any help would be appreciated.</p>