title: Compare values in Excel VBA
body: <p>I am trying to compare cell A1 with B1 and if it is true populate cell F1 with the A1 value. But irrespective of my input values the if condition becomes true.</p>
  
  <pre><code>Sub Macro3()
      Dim i As Integer
      i = 1
      For i = 1 To 10
          If (Range("A" &amp; i).Select = Range("B" &amp; i).Select) Then
              Range("A" &amp; i).Select
              Selection.Copy
              Range("F" &amp; i).Select
              ActiveSheet.Paste
          End If
      Next i      
  End Sub
  </code></pre>