title: VBA for SUMIF between different sheets
body: <p>Please refer to the below code:</p>
  <pre><code>Dim glAcnew As Variant
  Dim dummy As Variant, glnewTrans As Variant, count As Variant
  count = 0
  dummy = &quot;data&quot;
  glnew = InputBox(&quot;Enter tab name for new GL Accounts&quot;, &quot;GL Picker&quot;)
      Sheets(glnew).Select
  Sheets.Add.Name = glnew &amp; dummy &amp; count
      Set glnewTrans = Worksheets(glnew &amp; dummy &amp; count)
  Range(&quot;D7&quot;).Offset(0, count + 6).Select
      ActiveCell.Formula = &quot;=(SUMIF('&quot; &amp; ActiveWorkbook.Worksheets(glnew &amp; dummy &amp; count).Name &amp; &quot;'!A:A,Final!H7,'&quot; &amp; ActiveWorkbook.Worksheets(glnew &amp; dummy &amp; count).Name &amp; &quot;'!B:B)&quot;
  </code></pre>
  <p>This is giving me the following error:</p>
  <pre><code>Run-time error '1004'
  Application-defined or object-defined error
  </code></pre>
  <p>Please help me solve this.
  Thank you!</p>