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
0
Utf
5/13/2010 2:37:01 PM
excel.programming 6508 articles. 2 followers. Follow

3 Replies
1043 Views

Similar Articles

[PageSpeed] 55

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
0
Utf
5/13/2010 2:41:01 PM
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/showthread.php?t=202520

http://www.thecodecage.com/forumz

0
aflatoon
5/13/2010 3:57:10 PM
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/showthread.php?t=202520
> 
> http://www.thecodecage.com/forumz
> 
> .
> 
0
Utf
5/13/2010 5:09:02 PM
Reply:

Similar Artilces:

Question for "application-defined or object-defined error" retrieve outlook contact
Hello, I used the VB to retrieve the outlook XP contact list. When I run the application, it prompt a dialog box. In the following is the dialog box message: A program is trying to access e-mail addresses you have stored in Outlook. Do you want to allow this? If this is unexpected, it may be a virus and you should choose "No". When I click "Yes", the screen prompt out "Error 287: Application-defined or object-defined error". In normally, if click "Yes", the VB program can retrieve all contact records out, but in my case, it flows this error. Any exp...

Application-defined or object-defined error
Hi, I find myself stumped by an incredibly easy piece of code and one that I have used before. I am getting the error: Run-time error '1004': Application-defined or object-defined error I am getting the error when I run the following code: Private Sub Workbook_Open() With Application .ScreenUpdating = False .DisplayAlerts = False Workbooks.Open "\\depot02\rel\www\internal\business_areas\edg\Metrics\Phones\HighHoldTimesDetailed.xls" Workbooks("HighHoldTimesDetailed.xls").Worksheets("data").Cells.Copy _ Workbooks("phoneholdtime...

Application-Defined or Object-Defined error 287
My codes generate the error 287 at the objMail.Send. I think the path is wrong, but I don't know why. If I use "On Error Resume Next" above the Send, then there is no error popping up, but there is no email sent, either. Please show me how to fix it. Thank you. ------ strDocName = "frmStud" DoCmd.openfORM strDocName, acPreview, , "studId='" & glbStudId & "'" FileName = strDocName & ".pdf" DoCmd.OutputTo acOutputForm, strDocName, acFormatPDF, "C:\Temp\StudentForms\" & FileName, False ‘=...

Can't find source of Application-defined or object-defined error!?
I won't post all of the code here because it's too extensive but here's a watered down version (all variables declarations are not listed): Dim i as integer Dim PortName As String Dim ReviewSht As String Dim ModelSht As String Dim HoldingsSht As String Dim Model As Range PortName = Right(ActiveSheet.Name, Len(ActiveSheet.Name) - 15) ReviewSht = "Price Weight - " & PortName ModelSht = "Model Data - " & PortName HoldingsSht = "Holdings - " & PortName Application.ScreenUpdating = False With Worksheets(ModelSht).Range("A9") Range...

Can't find source of Application-defined or object-defined error!? #2
No worries folks -- figured it out. It was the reference to the zer column element in .Cells --- no such thing in a range but a zero i acceptable in .Offset references -- PropKi ----------------------------------------------------------------------- PropKid's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1013 View this thread: http://www.excelforum.com/showthread.php?threadid=27576 ...

Application-defined or object-defined error
I need help with this error. I get the error on line "ws.Range("E7").Value = mondaysDate(Weekday(Date)) - 7" The function run fine, its just that the erroe comes up when control is returned to the subroutine. And I don't know what the problem is. Any help will be appreciated. Thanks. Private Sub Workbook_Open() Dim ws As Worksheet Const PWORD As String = "Ayo" Application.ScreenUpdating = False If Me.Name = "Northeast AAV Project Outlook_ver2.xls" Then If Weekday(Date) = 2 Then For Each ws In Worksheets ...

Create New Form Error: Application-defined or Object-defined Error
I am trying to create a form using existing data table. I chose form by using wizard, selected fields, selected layout, and when I clicked "Next" then the message popped up. Thanks "DNT" <DNT@discussions.microsoft.com> wrote in message news:DEE6EDA4-AF57-44AE-A621-6FD681296946@microsoft.com... >I am trying to create a form using existing data table. I chose form by >using > wizard, selected fields, selected layout, and when I clicked "Next" then > the > message popped up. Thanks Try doing a Compact and Repair several times on...

Find: runtime error 1004 Application-defined or object-defined error
At the "Find" line, I get a runtime error 1004 Application-defined or object-defined error. I tried Googling this, but I could not find a solution for this particular occurrence. My code may be found below. Can anyone help? Thanks, Alan Sub ExtractMessages() Dim row As Long, LastRow As Long, temp As String, MsgRow As Long, LastMsgRow As Long, FindMsgName As String Dim pos As Integer, message As String, purpose As String, initiation As String, trigger As String Dim msgstriggered As String, MessageWS As Object, MessageListWS As Object, rng As Range...

runtime error 2465: application-defined or object-defined error
I'm trying to use a button on a main form to change the sort order of a sub- subform.When I execute the following, I get runtime error 2465: application- defined or object-defined error. opting to debug, I find the line with orderbyon highlighted. Anybody see what's wrong? Private sub timesort_click() Forms![control]![worklist]![approved].Form.OrderBy = "Forms![control]! [worklist]![approved]![time]" Forms![control]![worklist]![approved].Form.OrderBy0n = True End Sub -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/a...

Runtime Error 1004: Application-defined or object-defined error
Hello: Any idea what's causing this error? I have run this before with different scenario, but it now fails. It was written by others. Thankyou, Mary :confused: ' -- if buildable, process for partial constraints If isBuildable Then minBuildable = 100 Set partialConstraints = New Collection ' -- look for the primary (most restrictive) constraint on thi polygon, ' -- count the total number of constraints For Each cons In constraints If wsLoad.Cells(rLoad, cConstraints(cons.Index)) = "1" Then ERROR HERE If cons.PrimaryBuildable < minBuildable Then min...

Adding names to a cell
I made my own user defined function to act as a test function for me to try some stuff out in a sub that is being ran from a button. My test function is Function testFunc() As Integer On Error GoTo errhandler ActiveWorkbook.Names.Add Name:="ZOMGNAME", RefersTo:="=Sheet1!X20" testFunc = 1 errhandler: MsgBox Err.Description End Function The error I get is application-defined or object-defined error The function exists in the workbooks Module1 module Why am I getting the error? Thanks in advance You don't have any cell that contains a formula that t...

Runtime error 1004 application-defined or object-defined error
I tried to pose this on another group, MS Excel and VBA, but it still has not been posted, and I realize now that this group is much more active and accessible. . . . I am getting the error: "Runtime error 1004 application-defined or object-defined error" in the code provided below at this line of code: .Cells(StartRow + n - 1, 5).Value = _ WordDoc.Comments(n).Scope It is processing comments in a Word document and outputting them into Excel cells. It works fine on another document, but not on this particular document. However, the de...

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 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...