title: If statement on Sheet Range
body: <p>I am writing and Excel VBA if statement, but I can't figure out why it is not working.</p>
  
  <p>I have 1 Sheet called "Data" and I want to check if some variables in column I are the same as in my ActiveSheet row 2, column B (which is number 2). I used the following code which ends automatically because it is not working. Anybody an idea?</p>
  
  <p>Example:</p>
  
  <pre><code>Sub test()
  
  If Sheets("Data").Range("I:I") = ActiveSheet(2, 2) Then
  MsgBox ("Yes")
  Else
  MsgBox ("No")
  End If
  
  End Sub
  </code></pre>