title: How to check if date in a cell is in current month
body: <p>I'm trying to write an excel vba where the code will check for each row, if the DATE cell is in the current month or not.</p>
  <p>Example: excel cell = 01-01-2021 --&gt; check if month = currentmonth (01) -&gt; if yes, OK</p>
  <p>This is the code I have, it doesn't give errors but doesn't give results either (ignores the correct dates as if it's not correct):</p>
  <pre><code>            For i = 2 To LastRow1
                  'check if effective date = current month
                  If Month(.Cells(i, 17)) = Month(Now()) Then
                      'check if more than 5 days since initiated
                      If .Cells(i, 21).Value &gt; 5 Then
                          If .Cells(i, 11) = &quot;Onboarding&quot; Then
                              LastRow2 = Sh2.Range(&quot;A1&quot;).CurrentRegion.Rows.Count + 1
                      
                              'copy email 'awaiting person'
                              .Cells(i, 32).Copy Sh2.Range(&quot;A&quot; &amp; LastRow2)
  </code></pre>
  <p>I googled around a bunch, and found Month(Now()) to get the current month in a numeric value, but cells(i, 17) where the date is (01-01-2021 for instance) doesn't get seen as matching, even though it is.</p>