title: VBA formula too long, ways to shorten it
body: <p>Goodafternoon all,</p>
  
  <p>Currently facing a VBA issue, where the "record macro" function does work, but when I try to rerun it, it gives me the 1004 error.
  I recall that I could do three things:</p>
  
  <ol>
  <li>Split the formula up in parts, then refer to the next part in the formula (ie part 2= abc+def+ghi, so formula is 123+3456+ ____, then replace ____ with part 2)</li>
  <li>Put the formula as text in different cells, then refer to those cells in the formula (formula is cell("a1").value(?) + cell("b2").value(?)</li>
  <li>Give parts of the code a specific name, so that it will shorten the formula (ie abc = 'INPUT - MOTC!' then refer to abc in the formula</li>
  </ol>
  
  <p>Especially part 2 is something I could use some help with, since I don't know the exact reference, and I can always look back at the formula in the excel instead of going to the VBA.</p>
  
  <p>The formula itself is:</p>
  
  <pre><code>ActiveCell.FormulaR1C1 = _
      "=IF(WEEKDAY(RC2)=6,COUNTIFS('INPUT - MOTC'!C90,""confirmed"",'INPUT - MOTC'!C101,""1"",'INPUT - MOTC'!C74,""500"",'INPUT - MOTC'!C86,""&lt;&gt;C"",'INPUT - MOTC'!C47,""&lt;""&amp;R2C11,'INPUT - MOTC'!C45,""&lt;""&amp;R2C12,'INPUT - MOTC'!C93,""No"",'INPUT - MOTC'!C105,""No"",'INPUT - MOTC'!C99,""No"",'INPUT - MOTC'!C47,RC2)" &amp; _
      "+COUNTIFS('INPUT - MOTC'!C90,""confirmed"",'INPUT - MOTC'!C101,""1"",'INPUT - MOTC'!C74,""500"",'INPUT - MOTC'!C86,""&lt;&gt;C"",'INPUT - MOTC'!C47,""&lt;""&amp;R2C11,'INPUT - MOTC'!C45,""&lt;""&amp;R2C12,'INPUT - MOTC'!C93,""No"",'INPUT - MOTC'!C105,""No"",'INPUT - MOTC'!C99,""No"",'INPUT - MOTC'!C47,RC2+1)" &amp; _
      "+COUNTIFS('INPUT - MOTC'!C90,""confirmed"",'INPUT - MOTC'!C101,""1"",'INPUT - MOTC'!C74,""500"",'INPUT - MOTC'!C86,""&lt;&gt;C"",'INPUT - MOTC'!C47,""&lt;""&amp;R2C11,'INPUT - MOTC'!C45,""&lt;""&amp;R2C12,'INPUT - MOTC'!C93,""No"",'INPUT - MOTC'!C105,""No"",'INPUT - MOTC'!C99,""No"",'INPUT - MOTC'!C47,RC2+2)" &amp; _
      ",COUNTIFS('INPUT - MOTC'!C90,""confirmed"",'INPUT - MOTC'!C101,""1"",'INPUT - MOTC'!C74,""500"",'INPUT - MOTC'!C86,""&lt;&gt;C"",'INPUT - MOTC'!C47,""&lt;""&amp;R2C11,'INPUT - MOTC'!C45,""&lt;""&amp;R2C12,'INPUT - MOTC'!C93,""No"",'INPUT - MOTC'!C105,""No"",'INPUT - MOTC'!C99,""No"",'INPUT - MOTC'!C47,RC2)"
  </code></pre>
  
  <p>Am I doing something wrong, or is the formula just too long?</p>
  
  <p>(little background, I would like to add the values of saturday&amp;sunday to the value of friday, so if weekday is 6, then do so).</p>
  
  <p>Thanks in advance :)</p>