title: Matching date in VBA
body: <p>I am using this code to match dates. </p>
  
  <p>Code:</p>
  
  <pre><code>    strDate1 = Sheets("Part2").Cells(i, 1).Value
      date1 = DateSerial(Left(strDate1, 4), Mid(strDate1, 3, 2), Right(strDate1, 2))
      srtDate2 = Format(DateAdd("yyyy", -1, date1), "yyyymmdd")
      matchStartRow = Application.Match(CDbl(srtDate2), Sheets("1.A").Range("A:A"), 1)
      If IsError(matchStartRow) Then
          matchStartRow = 3
      Else
          matchStartRow = matchStartRow + 1
      End If
  </code></pre>
  
  <p>If dates match, matchstartrow should remain as it. If it doesn't match, it need to add one. How to incorporate this? Code seems to be wrong.. </p>
  
  <p>Need some guidance to modify this..</p>
  
  <p>code for this was obtained from:<a href="https://stackoverflow.com/questions/22746584/how-to-get-date-1-year-in-vba">How to get date - 1 year in vba</a></p>