title: Copy cells and paste by overwriting cells in another sheet based on a criteria
body: <p>I am trying to create a VBA code dependent on date. Here is my information:</p>
  
  <p>Sheet 1: I have a table starting at cell A1 and going to G29. Cell B2 has the date, which has been coded using the TODAY option in Excel.</p>
  
  <p>Now this table has to be updated every day, but once the day is over, I want to save the contents of this table and clear Sheet 1 for the next day. I want to save it all in a hidden sheet, Sheet 2.</p>
  
  <p>At the moment, I have managed to get everything to copy and paste into Sheet 2 and then activate a cell below my table so it is ready to be copy and pasted the next day.</p>
  
  <p>The issue I am having is that every time I run my macro, it copies and pastes the table into the selected cell below what I have already got in Sheet 2. So for any particular date, I could potentially have 3,4,5,whatever variations of the same table, all one underneath each other.</p>
  
  <p>What I therefore want to do is tell my VBA code that if the value in cell B2 (sheet 1) is x and the value in the corresponding date cell in sheet 2 is the same, to copy and paste in those same cells.</p>
  
  <p>I know how to do the last bit, what I would like help figuring out (for now) is how do I tell it to do my specific searches and activation of cells on both sheets, bearing in mind it needs to be kept general as after one date, the next date cell in Sheet 2 will be around 31 cells below B2, and then 31 cells below that, etc, etc.</p>
  
  <p>Here is my current macro:</p>
  
  <pre><code>Sub Macro1()
  '
  ' Macro1 Macro
  '
  ' Acceso directo: CTRL+h
  '
      Range("A1:G29").Select
      Selection.Copy
      Sheets("Hoja2").Select
      Range("A1").Select
      ActiveSheet.Paste
      Range("A1").Select
      ActiveCell.Offset(31, 0).Select
  
  End Sub
  </code></pre>
  
  <p>This does my copy and paste and selects the cell below. However I am struggling with getting Excel to paste on a specific cell based on the date.</p>
  
  <p>I hope this makes sense. If people have any questions then please let me know!  </p>