title: Goal Seek Macro with Goal as a Formula
body: <p>I'm grasping at straws here, so any help would be great (ie. I have no idea what I'm doing with VBA).</p>
  
  <p>I'm trying to solve a circular reference problem in Excel by creating a goal seek macro - basically</p>
  
  <ol>
  <li><code>S3 = M + S2</code>, </li>
  <li><code>S3 = L * G</code>. </li>
  </ol>
  
  <p>I want to goal seek S3 to equal <code>L * G</code> by changing M. </p>
  
  <p>So, I've put</p>
  
  <ul>
  <li><code>L * G</code> in cell <code>H32</code>,</li>
  <li><code>S3</code> in <code>H18</code>,</li>
  <li><code>M</code> in <code>G18</code>,</li>
  <li><code>S2</code> in <code>F18</code></li>
  </ul>
  
  <p>and this is what I've gathered so far. </p>
  
  <pre><code>Sub GoalSeek()   
  Dim x As Integer
  x = Range("H32").Value    
  Range("H18").GoalSeek Goal:=x, ChangingCell:=Range("G18")     
  End Sub
  </code></pre>
  
  <p>I'm getting a "Reference is not valid" error, ideas?
  Thanks!</p>