I have done similar with a complex solver function to resolve a fairly sophisticated model of a synthesis gas loop with tail gas blending. Have just tried simple sample with goalseek and also works.
OK here goes :
Lets say in cell "A1" you have the result of the IF test - ie true or false - not a value in this code.
In "B1" you have the cell you wish to vary such that cell "B2" equals some specific target, say 12 here.
In VBasic mode, enable the project view and double click on the sheet in which the goalseek is to operate. In the code sheet view, write :
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("A1"

Then
Range("B2"

.GoalSeek Goal:=12, ChangingCell:=Range("B1"

End If
End Sub
Now what happens is every time anything on that sheet changes, it checks if A1 is true and if so executes the goalseek.
But beware - if lot of calcs on the go, especially when iterating, can get very slow or some strange hangups occurring. As usual make sure you have a master copy somewhere before adding in this function!!