ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Goal Seek (https://www.excelbanter.com/excel-programming/313678-goal-seek.html)

Jeff

Goal Seek
 
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







Tom Ogilvy

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

--
Regards,
Tom Ogilvy

"Jeff" wrote in message
...
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









Jeff

Goal Seek
 
Thanks

That solution worked for me.

"Tom Ogilvy" wrote:

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

--
Regards,
Tom Ogilvy

"Jeff" wrote in message
...
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











All times are GMT +1. The time now is 04:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com