title: Copy and paste data based on criteria
body: <p>I have written a macro code to copy data from one worksheet (Sheet2) and paste on another worksheet (Sheet1). This works fine. But, I would like to have a condition to determine the location to paste the data in Sheet1. 
  The condition is that if the country selected (from a dropdown) in cell A1 in Sheet2, is found in column A in Sheet1 (which has copied data), update (overwrite) that country data with the latest data, else if it is a new country it should paste the new data below the last set of data on Sheet1.</p>
  
  <p>Here's the code I have written until now:</p>
  
  <pre><code>Private Sub CommandButton1_Click()
  ActiveSheet.Range("A1:F44").Copy
      With Sheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
          .PasteSpecial xlPasteFormats
      ActiveSheet.Range("A1:F44").Copy
      With Sheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
          .PasteSpecial xlPasteValues
      Application.CutCopyMode = False
      Sheets("Sheet2").Activate
  End With
  End With
  End Sub
  </code></pre>
  
  <p>Any help would be highly appreciated! Many thanks!</p>