title: Compare 2 cells in different sheets in VBA(Excel 2010)
body: <p>Hi Can I ask for a sample macro code to compare 2 different columns from 2 different sheets.</p>
  
  <p>Here's the columnA in sheet1</p>
  
  <p><img src="https://i.stack.imgur.com/WCq5s.png" alt="enter image description here"></p>
  
  <p>Here's the column A in sheet2
  <img src="https://i.stack.imgur.com/0nQ6n.png" alt="enter image description here"></p>
  
  <p>Here's what I need to make as an output in sheet1</p>
  
  <p><img src="https://i.stack.imgur.com/4Gd1m.png" alt="enter image description here"></p>
  
  <p>Then all cells in column A sheet1 without match such as red in the picture above should be cut and copied in column C in sheet1 like the below
  <img src="https://i.stack.imgur.com/DlhAk.png" alt="enter image description here"></p>
  
  <p>lastly all cells in column A sheet 2 that has no match should be cut as well and pasted in column D in sheet 1 such as ABC:PINK, ABC:VIOLET and ABC:BLACK as shown below</p>
  
  <p><img src="https://i.stack.imgur.com/W39zM.png" alt="enter image description here"></p>
  
  <p>Thanks for the help in advance.</p>
  
  <p>Here's what I got so far</p>
  
  <pre><code>Sub Button1_Click()
  On Error GoTo ErrorHndler:
  Dim myRange As Range
  Dim sRng As Range
  
  Set myRange = Range("A1:A50")
  
  Start:
       For Each sRng In myRange
         If sRng Like Sheets("Sheet2").Range("A1").Value Then
            MsgBox (Sheets("Sheet2").Range("A1").Value) &lt;----it does not pass here 
            (----I have no Idea what to put here-----)
            'GoTo NextCell
         Else
            'GoTo Start
            MsgBox (Sheets("Sheet2").Range("A1").Value)
            'MsgBox "Doesn't match"  &lt;-----for debugging purposes
         End If
   NextCell:
   Next sRng
  
   ErrorHandler:
   MsgBox ""
   End Sub
  </code></pre>