There is method to use goal seek in MS excel like follows code. It works fine.
Sub GSeek()
With Worksheets("Sheet1")
.Range("H18").GoalSeek _
Goal:=.Range("H21").Value, _
ChangingCell:=.Range("G18")
End With
End Sub
And I would like to use a function to do the goal seek like follows.
Function fSeek(a As Range, b As Range, c As Range)
a.GoalSeek Goal:=b.Value, ChangingCell:=c
fSeek = "Ok"
End Function
However, the code work peacefully and no answer was got in the range c. Where am I wrong?