title: VBA code for sumifs function
body: <p>I have the following code and I get run-time error '1004'  is it to do with text as the variables?  Ive tried also refering to the cells that contain my condition directly but have the same problem</p>
  
  <pre><code>Sub sumifs()
  Dim Month_tally As Double
  Dim Monthrange As Range
  
  Set Monthrange = Range("B2:D5")
  Set months = Range("B1:D1")
  Set Prospects = Range("A2:A4")
  
  Range("B6").Formula = WorksheetFunction.sumifs(Monthrange, months, (May), Prospects, (CN))
  
  End Sub
  
  
  May June    July
  </code></pre>
  
  <p>CN  456 2   2
  Nj  2   2   2
  BH  2   456 5647
  BG  4567    2   2</p>