title: VBA: Using the DateAdd Function
body: <p>I have a spreadsheet of with identical rows repeated in sequences of three. For example below A represents a row of information.  In column S are dates.  I'd like to change the date in column S in the second row of each sequence to one month after the original date and the third row of each sequence to two months after the original date and do continue this for the entire spreadsheet using a loop and the <code>DateAdd</code> function. </p>
  
  <p>Here is the code I have now, but the I'm getting a compile error on the <code>DateAdd</code> function (this is my first time using it):</p>
  
  <pre><code>Sub DateChange()
  
  Dim r As Long
  
  Application.ScreenUpdating = False
  
  For r = Range("A" &amp; Rows.Count).End(xlUp).Row To 1 Step -1
      With Cells(r, 1).EntireRow
          .Copy
          .Resize(2).Offset(1, 0).Insert Shift:=xlDown
      End With
      Cells(r + 1, "S").Value = DateAdd("m", 1, Cells(r, "S"))
      Cells(r + 2, "S").Value = DateAdd("m", 2, Cells(r, "S"))
  Next r
  
  Application.ScreenUpdating = True
  
  End Sub
  </code></pre>