ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error of "application-defined or object-defined error" in Goalseek (https://www.excelbanter.com/excel-programming/442536-error-application-defined-object-defined-error-goalseek.html)

Edward Wang

Error of "application-defined or object-defined error" in Goalseek
 
Hi all,
I always have above error while running below code in the excel 2007,
please help me out!

Sub GoalSeekTry()
Source = Cells(8, 7)
x = Cells(7, 7).Value
ActiveSheet.Range(Source).GoalSeek Goal:=-800,
ChangingCell:=ActiveSheet.Range(x)
End With
End Sub

Source = X*X +X*300

Regards,
Edward

Edward Wang

Error of "application-defined or object-defined error" in Goalseek
 
sorry adjust the code little bit by removing "End With"

Sub GoalSeekTry()
Source = Cells(8, 7)
x = Cells(7, 7).Value
ActiveSheet.Range(Source).GoalSeek Goal:=-800,
ChangingCell:=ActiveSheet.Range(x)
End Sub

"Edward Wang" wrote:

Hi all,
I always have above error while running below code in the excel 2007,
please help me out!

Sub GoalSeekTry()
Source = Cells(8, 7)
x = Cells(7, 7).Value
ActiveSheet.Range(Source).GoalSeek Goal:=-800,
ChangingCell:=ActiveSheet.Range(x)
End With
End Sub

Source = X*X +X*300

Regards,
Edward


aflatoon[_19_]

Error of "application-defined or object-defined error" in Goalseek
 

Your code is unclear to me, but I think you mean:


Code:
--------------------



Sub GoalSeekTry()
Set Source = Cells(8, 7)
Source.GoalSeek Goal:=-800, ChangingCell:=ActiveSheet.Cells(7, 7)
End Sub
--------------------





Edward Wang;723120 Wrote:

sorry adjust the code little bit by removing "End With"

Sub GoalSeekTry()
Source = Cells(8, 7)
x = Cells(7, 7).Value
ActiveSheet.Range(Source).GoalSeek Goal:=-800,
ChangingCell:=ActiveSheet.Range(x)
End Sub

"Edward Wang" wrote:

Hi all,
I always have above error while running below code in the excel

2007,
please help me out!

Sub GoalSeekTry()
Source = Cells(8, 7)
x = Cells(7, 7).Value
ActiveSheet.Range(Source).GoalSeek Goal:=-800,
ChangingCell:=ActiveSheet.Range(x)
End With
End Sub

Source = X*X +X*300

Regards,
Edward



--
aflatoon

Regards,
A.
------------------------------------------------------------------------
aflatoon's Profile: http://www.thecodecage.com/forumz/member.php?u=1501
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=202520

http://www.thecodecage.com/forumz


Edward Wang

Error of "application-defined or object-defined error" in Goal
 
Yes, that is correct!

"aflatoon" wrote:


Your code is unclear to me, but I think you mean:



Code:
--------------------




Sub GoalSeekTry()
Set Source = Cells(8, 7)
Source.GoalSeek Goal:=-800, ChangingCell:=ActiveSheet.Cells(7, 7)
End Sub


--------------------






Edward Wang;723120 Wrote:

sorry adjust the code little bit by removing "End With"

Sub GoalSeekTry()
Source = Cells(8, 7)
x = Cells(7, 7).Value
ActiveSheet.Range(Source).GoalSeek Goal:=-800,
ChangingCell:=ActiveSheet.Range(x)
End Sub

"Edward Wang" wrote:

Hi all,
I always have above error while running below code in the excel

2007,
please help me out!

Sub GoalSeekTry()
Source = Cells(8, 7)
x = Cells(7, 7).Value
ActiveSheet.Range(Source).GoalSeek Goal:=-800,
ChangingCell:=ActiveSheet.Range(x)
End With
End Sub

Source = X*X +X*300

Regards,
Edward



--
aflatoon

Regards,
A.
------------------------------------------------------------------------
aflatoon's Profile: http://www.thecodecage.com/forumz/member.php?u=1501
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=202520

http://www.thecodecage.com/forumz

.



All times are GMT +1. The time now is 01:55 AM.

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