title: Mathematical equation in vba
body: <p>I have mathematical equation which I am performing in sheet <strong>"<code>Accrued Expenses</code>"</strong> on <strong><code>Range("E7")</code></strong>. The formula is intend to <strong>loop</strong>  till the <strong>lastrow in column C</strong> The two key sheets are <strong>"Start page"</strong> and <strong>"Accrued Expenses"</strong> .  </p>
  
  <p><strong>The problem</strong> is that <strong>I am not able to get into VBA code</strong>. It works using the Excel macro recorder, but it wont be efficient for maintenance. My equation and code below. </p>
  
  <pre><code>=('Accrued Expenses'!C7*'Start page'!$F$5)/'Start page'!$F$13*'Accrued Expenses'!D7
  </code></pre>
  
  <p>In <strong>Excel recorder code</strong> and with a loop:</p>
  
  <pre><code>Option Explicit
  Sub Calculating_Accruedexpense()
      Sheets("Accrued Expenses").Select
      Dim LastRow As Long
      LastRow = ActiveSheet.Range("C" &amp; Rows.Count).End(xlUp).row
      Range("E7").Select
      Do Until ActiveCell.row = LastRow + 1
          If IsEmpty(ActiveCell) Then
              ActiveCell.FormulaR1C1 = _
                  "=('Accrued Expenses'!RC[-2]*'Start page'!R5C6)/'Start page'!R13C6*'Accrued Expenses'!RC[-1]"
          End If
          ActiveCell.Offset(1, 0).Select
      Loop
  End Sub
  </code></pre>
  
  <p>Excel Recorder line:</p>
  
  <pre><code>ActiveCell.FormulaR1C1 = _
              "=('Accrued Expenses'!RC[-2]*'Start page'!R5C6)/'Start page'!R13C6*'Accrued Expenses'!RC[-1]"
  </code></pre>