The following code demonstrates how to utilize goal seek in Microsoft Excel. It runs smoothly.
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
The code, however, operated without incident, and the range c received no response. Where have I gone wrong?