replace the old macro with this
Sub goalseek()
Dim Opt_a, Opt_b, Opt_c, t As Integer
Dim A, B, C As Single
Range("D10:f10").Clear
Range("E10").Select
ActiveCell.FormulaR1C1 = "=(RC[-2]-RC[-1]*R[-1]C[-1]-RC[1]*R[-1]C[1])/R[-1]C"
Range("D11:F12").Select
For t = Int(Range("b10").Value / 2) To Range("b10").Value
Range("d10").Value = t
Range("G10").goalseek goal:=1, ChangingCell:=Range("F10")
A = Round(Range("d10").Value, 2)
B = Round(Range("e10").Value, 2)
C = Round(Range("f10").Value, 2)
If A > 0 And B > 0 And C > 0 And A = Int(A) And B = Int(B) And C = Int(C) Then
A = Range("d10").Value
B = Range("e10").Value
C = Range("f10").Value
GoTo 10
End If
Next t
10
Range("d10").Value = A
Range("e10").Value = B
Range("f10").Value = C
End Sub
Bookmarks