+ Reply to Thread
Results 1 to 3 of 3

Problems in Goalseek

  1. #1
    Registered User
    Join Date
    01-26-2007
    Posts
    2

    Problems in Goalseek

    Hi everyone,

    I have the following VB code:

    Sub solver()

    Dim nindex As Integer
    For nindex = 1 To 10
    ws1.Range("L2" & CStr(nindex)).goalseek ws1.Range("M" & CStr(nindex)).Value, ws1.Range("J2" & CStr(nindex))
    Next nindex

    End Sub

    when I enter the excell and try to run it, I get an error reply number 424: object required.

    What is the problem ?

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    You have not set ws1 - See code in Red

    I have included 2 version s of setting ws1 - by name & sheet number


    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    01-24-2007
    Location
    Southampton, UK
    Posts
    137
    I think the problem is that "ws1" is not defined. Presumably this should refer to the active sheet, and therefore your code should include the following -

    Dim ws1 as Worksheet
    Set ws1 = Activesheet

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1