title: If date in one column is the same, then sum the values in another column
body: <p>I am fairly new at VBA and I am currently trying to rework an existing macro that sums hours of a workday up by employee for the week.</p>
  
  <p>I need a macro that will sum up the work hours by just a single day instead of a weekly total. There are two entries per day for each employee. Then, this total is copy and pasted into a different column.</p>
  
  <p>I can not use a pivot table as this macro will be used on a different spreadsheet every week. I also can not have a reference sheet. This is going to be applied to a spreadsheet that is emailed every week, so it is constantly changing. </p>
  
  <p>Basically... if the date in Column B is the same, I need the sum of hours in Column C, then that Sum is pasted over to a new column (D is fine).  </p>
  
  <p>Below is what the original report looks like at this point:</p>
  
  <pre><code>  A               B         C
  Joe Smith  --  03/26/2018 -- 3.65
  Joe Smith  --  03/26/2018 -- 4.46
  Joe Smith  --  03/27/2018 --  5.45
  Joe Smith  --  03/27/2018 --  2.93
  </code></pre>
  
  <p>The existing macro is :</p>
  
  <pre><code>For Each x In n.Range(n.Range("B2"), n.Range("B" &amp; Rows.Count).End(xlUp))
      x.Value = Month(x.Value) &amp; "/" &amp; Day(x.Value) &amp; "/" &amp; Year(x.Value)
  Next x
  For Each x In n.Range(n.Range("J2"), n.Range("J" &amp; Rows.Count).End(xlUp))
      Set r = n.Range(x.Address)
      r.Offset(0, 1).Value = 
      Format(Application.WorksheetFunction.Max(n.Range(n.Range("B2"), n.Range ("B" &amp; Rows.Count).End(xlUp))), "MM/DD/YYYY")
      r.Offset(0, 2).Value = Application.WorksheetFunction.SumIf(n.Range("A:A"), x.Value, n.Range("E:E"))
      For I = 3 To UBound(TableHeaders)
          ch = TableHeaders(I)
          r.Offset(0, I).Value = Application.WorksheetFunction.SumIfs(a.Range("R:R"), 
          a.Range("L:L"), ch, a.Range("A:A"), x.Value)
      Next I
  
      d.RemoveAll
  Next x
  </code></pre>