title: Skipping goalseek calculation when goal = 0
body: <p>I have made a goalseek function that runs through several columns and automatically does calculation, even when the value selected in the goal field is equal to 0. </p>
  
  <p>I want the sub to skip calculations whenever there is a "0" in my sheet and go to the next column. </p>
  
  <p>Tried to add <code>If cell.Value &gt; 0 And cell.Value &lt;= cell.Offset(-1).Value Then _</code>, but it didn't work. It just inserted 0's in all the cells.</p>
  
  <p>Here's my code: </p>
  
  <pre><code>Sub Goalseek()
      Dim rng As Range
      Dim cell As Range
  
      Set rng = ThisWorkbook.Worksheets("pb_input").Range("BB62:BP62")
          rng.Offset(1).Value = 0
      For Each cell In rng.Cells
          If cell.Value &lt;= cell.Offset(-1).Value Then _
          cell.Offset(2) = 1 Else _
          cell.Offset(2) = -1
          cell.Goalseek Goal:=cell.Offset(-1).Value, ChangingCell:=cell.Offset(1)
      Next
  End Sub
  </code></pre>