title: Goal Seek with Excel Macro
body: <p>I am using a record of an Excel Macro for a Goal Seek function on Excel. The problem is that when I try to add a new row in my sheet (both above the cells running the Goal Seek or even in the middle of them), the Macro that i recorded cannot be used anymore and I need to record it again (the error that i receive if i try to run it is:&quot;1004, reference is not valid&quot;). How could I fix this so that I don't need to record everytime the same Macro when I add/delete a row? Please help me. I attach below the pics and the VBA code</p>
  <p><a href="https://i.stack.imgur.com/2fhQ8.png" rel="nofollow noreferrer">Before</a>
  <a href="https://i.stack.imgur.com/7XPib.png" rel="nofollow noreferrer">After</a></p>
  <pre><code>Sub Macro17()
  '
  ' Macro17 Macro
  '
  
  '
      Application.CutCopyMode = False
      Application.CutCopyMode = False
      ActiveCell.GoalSeek Goal:=0, ChangingCell:=ActiveCell.Offset(-9, 0).Range( _
          &quot;A1&quot;)
  End Sub
  </code></pre>