title: VBA: Copying data to a worksheet that checks if record exists
body: <p>I have two worksheets, a pretty input worksheet for the end user to input data, and a data sheet to store the data after they enter it in. The input sheet has names in the first two columns (first and last) and has 2 or 3 columns after of data for that person. Right now my code takes all 5 columns, reads it into a dynamic array and writes it to the datasheet worksheet.
  The amount of names in the input sheet can be added or subtracted at anytime. I want to know a way for excel to check if the names are already in the data sheet, and if they are just overwrite the data for that person. If that person doesn't exist then create a new line and copy the data over for that person. </p>
  
  <p>Right now my code works by essentially copying the entire array, finding the next available row in the datasheet, and then writing the entire array there. The problem is that if I have 5 people, and I run my code to do this twice, I get two different instances of the same person. I can't just change my Range to activecell and overwrite it with the latest iteration of the input page because there are different grouping variables for the people. So when Group1 is selected on a different page, the input page is populated with only Group1 members, and then with Group2 etc. But I need to save them all to the same sheet.</p>
  
  <p>This is what the code looks like now:</p>
  
  <pre><code>Dim BehvData() As Variant
  Sheets("i_Behavior").Activate
  BehvData = Range("A8", Range("A8").End(xlDown).Offset(0, 4))
  Worksheets("BehvDataSheet").Select
  Range("A3").Select
  Range(ActiveCell.End(xlDown), ActiveCell.End(xlDown).Offset(UBound(BehvData, 1) - 1, 4)).Value = BehvData
  Erase BehvData
  </code></pre>
  
  <p>I'm very new to VBA and I appreciate your help here.</p>