title: Why the last line send me a 0 answers
body: <p>I want to change all the formulas in an excel reporting into a VBA macro.
  I have a table with all my supplier and I want a sum in another column.
  For that I have to a Sumifs function, the results send me 0 for each line and I don't know why</p>
  
  <pre><code>Dim NSynthese As Worksheet
  Dim NTABLEAU As Worksheet
  Dim Source_CAS As Worksheet
  Dim CAS_offres As Worksheet
  Dim FP_offres As Worksheet
  Dim lderLigne_source_CAS As Long
  Dim lderLigne_NTABLEAU As Long
  Dim ddate_CAS_max As Date
  Dim h As Long   
  
   With Application.WorksheetFunction
  
              For h = 4 To lderLigne_NTABLEAU
  
              NTABLEAU.Cells(h + 1, 8).Value = .SumIfs(Source_CAS.Columns("T"), _
                                                       Source_CAS.Columns("AE"), _
                                                       NTABLEAU.Cells(h + 1, 4), _
                                                       Source_CAS.Columns("C"), _
                                                       ddate_CAS_max)
  
              Next h
      End with
  </code></pre>
  
  <p>I don't have a message error just a "-" result in each cells <code>(NTABLEAU.Cells(h + 1, 8))</code> and I expect a number</p>
  
  <p>the excel formula is </p>
  
  <pre><code>: =SOMME.SI.ENS(Source_CAS!T:T;Source_CAS!AE:AE;NTABLEAU!D9;Source_CAS!C:C;datemax_CAS); 
  </code></pre>
  
  <p>ddate_CAS_max is a date that I also put in the cell named datemax_CAS. 
  the excel formula works.</p>
  
  <p>The mistake was in the definition of the date, 
  I put : </p>
  
  <pre><code>NSynthese.Range("datemax_CAS").Value = Application.WorksheetFunction.Max(Source_CAS.Range("c2:c" &amp; lderLigne_source_CAS))
  </code></pre>
  
  <p>instead of : </p>
  
  <pre><code>ddate_CAS_max = Application.WorksheetFunction.Max(Source_CAS.Range("c2:c" &amp; lderLigne_source_CAS))
  NSynthese.Range("datemax_CAS").Value = ddate_CAS_max
  </code></pre>