Goal Seek

G

Guest

Hi,

I wrote the following code to calculate IRR.

Sub IRR()
Dim X As String
X = Range("F9").Value
Range("H9").GoalSeek Goal:=X, ChangingCell:=Range("F4")
End Sub

This works fine alone, but when I put it in a Command Button and use:
Call IRR

I get the following error:

"GoalSeek Method of Range Class Failed"

Does anyone know what the problem is?

Thanks
 
T

Tom Ogilvy

Just a guess, but:
If your using Excel 97, change the takefocusonclick property of the command
button to false.
 
G

Guest

Thanks

That solution worked for me.

Tom Ogilvy said:
Just a guess, but:
If your using Excel 97, change the takefocusonclick property of the command
button to false.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top