title: Formula to combine variable and cell references
body: <p>I have been looking for hours for a solution but couldn't find any. I am an absolute beginner in VBA and couldn't figure this out for myself. The thing I would like to do is that VBA enters in a cell a formula that will contain a value extracted from a variable and then subtracts all the below cells. The cells below could change which would affect the overall value so I need to leave it as dynamic. (e.g: Cell A1 should look like this: =500-A2-A3-A4.. etc).
  The code looks like this at the moment. So far it only enters the value from the variable</p>
  
  <pre><code>crnt = Cells(5, "D").Value
  Range("E60").Select
  ActiveCell.Offset(0, crnt - 1).Activate
  rev = ActiveCell.Value
  Range("E9").Select
  ActiveCell.Offset(0, crnt - 1).Select
  ActiveCell.Value = rev
  </code></pre>