+ Reply to Thread
Results 1 to 5 of 5

Can't find "Solver"

Hybrid View

  1. #1
    Bill Allen
    Guest

    Can't find "Solver"

    I'm writing one of my first macros and I would appreciate some help.

    I am trying to automate the Solver add-in. I started by using the macro
    recorder which generated the following:

    Sub SolveForK()
    '
    ' SolveForK Macro
    ' Macro recorded 1/29/2005 by Bill Allen, S.E.
    '
    ' Keyboard Shortcut: Ctrl+Shift+K
    '
    SolverOk SetCell:="$R$5", MaxMinVal:=3, ValueOf:="0", ByChange:="$Q$5"
    SolverSolve
    End Sub

    Question 1:
    When I try to execute the code, I get the following error:

    With the "SolverOk" highlighted, the error reads:
    ---------------------------
    Microsoft Visual Basic
    ---------------------------
    Compile error:

    Sub or Function not defined
    ---------------------------
    OK Help
    ---------------------------

    What is wrong with the code? What do I need to fix?

    Thanks,

    Bill




  2. #2
    Bill Allen
    Guest

    Re: Can't find "Solver"

    Oops. Sent to the wrong group.

    Sorry.

    "Bill Allen" <[email protected]> wrote in message
    news:8BPKd.4225$G31.2964@okepread05...
    > I'm writing one of my first macros and I would appreciate some help.
    >
    > I am trying to automate the Solver add-in. I started by using the macro
    > recorder which generated the following:
    >
    > Sub SolveForK()
    > '
    > ' SolveForK Macro
    > ' Macro recorded 1/29/2005 by Bill Allen, S.E.
    > '
    > ' Keyboard Shortcut: Ctrl+Shift+K
    > '
    > SolverOk SetCell:="$R$5", MaxMinVal:=3, ValueOf:="0", ByChange:="$Q$5"
    > SolverSolve
    > End Sub
    >
    > Question 1:
    > When I try to execute the code, I get the following error:
    >
    > With the "SolverOk" highlighted, the error reads:
    > ---------------------------
    > Microsoft Visual Basic
    > ---------------------------
    > Compile error:
    >
    > Sub or Function not defined
    > ---------------------------
    > OK Help
    > ---------------------------
    >
    > What is wrong with the code? What do I need to fix?
    >
    > Thanks,
    >
    > Bill
    >
    >
    >




  3. #3
    Ken Wright
    Guest

    Re: Can't find "Solver"

    Not necessarily - This one is a bit of a catchall. Take a look in the VBA
    help files for solver and notice the bit that says

    Before you use this function, you must establish a reference to the Solver
    add-in. With a Visual Basic module active, click References on the Tools
    menu, and then select the Solver.xla check box under Available References.
    If Solver.xla doesn't appear under Available References, click Browse and
    open Solver.xla in the \Office\Library\Solver\ subfolder.

    Does that help?

    --
    Regards
    Ken....................... Microsoft MVP - Excel
    Sys Spec - Win XP Pro / XL 97/00/02/03

    ----------------------------------------------------------------------------
    It's easier to beg forgiveness than ask permission :-)
    ----------------------------------------------------------------------------

    "Bill Allen" <[email protected]> wrote in message
    news:wDPKd.4227$G31.2529@okepread05...
    > Oops. Sent to the wrong group.
    >
    > Sorry.
    >
    > "Bill Allen" <[email protected]> wrote in message
    > news:8BPKd.4225$G31.2964@okepread05...
    > > I'm writing one of my first macros and I would appreciate some help.
    > >
    > > I am trying to automate the Solver add-in. I started by using the macro
    > > recorder which generated the following:
    > >
    > > Sub SolveForK()
    > > '
    > > ' SolveForK Macro
    > > ' Macro recorded 1/29/2005 by Bill Allen, S.E.
    > > '
    > > ' Keyboard Shortcut: Ctrl+Shift+K
    > > '
    > > SolverOk SetCell:="$R$5", MaxMinVal:=3, ValueOf:="0",

    ByChange:="$Q$5"
    > > SolverSolve
    > > End Sub
    > >
    > > Question 1:
    > > When I try to execute the code, I get the following error:
    > >
    > > With the "SolverOk" highlighted, the error reads:
    > > ---------------------------
    > > Microsoft Visual Basic
    > > ---------------------------
    > > Compile error:
    > >
    > > Sub or Function not defined
    > > ---------------------------
    > > OK Help
    > > ---------------------------
    > >
    > > What is wrong with the code? What do I need to fix?
    > >
    > > Thanks,
    > >
    > > Bill
    > >
    > >
    > >

    >
    >




  4. #4
    Bill Allen
    Guest

    Re: Can't find "Solver"

    Ken -

    That helps a lot. As you may have suspected, the check box was unchecked.

    This concept will help when I don't have a code workaround.

    I hope I remember with that time comes :o).

    Regards,

    Bill Allen


    "Ken Wright" <[email protected]> wrote in message
    news:[email protected]...
    > Not necessarily - This one is a bit of a catchall. Take a look in the VBA
    > help files for solver and notice the bit that says
    >
    > Before you use this function, you must establish a reference to the Solver
    > add-in. With a Visual Basic module active, click References on the Tools
    > menu, and then select the Solver.xla check box under Available References.
    > If Solver.xla doesn't appear under Available References, click Browse and
    > open Solver.xla in the \Office\Library\Solver\ subfolder.
    >
    > Does that help?
    >
    > --
    > Regards
    > Ken....................... Microsoft MVP - Excel
    > Sys Spec - Win XP Pro / XL 97/00/02/03
    >
    > ----------------------------------------------------------------------------
    > It's easier to beg forgiveness than ask permission :-)
    > ----------------------------------------------------------------------------
    >
    > "Bill Allen" <[email protected]> wrote in message
    > news:wDPKd.4227$G31.2529@okepread05...
    >> Oops. Sent to the wrong group.
    >>
    >> Sorry.
    >>
    >> "Bill Allen" <[email protected]> wrote in message
    >> news:8BPKd.4225$G31.2964@okepread05...
    >> > I'm writing one of my first macros and I would appreciate some help.
    >> >
    >> > I am trying to automate the Solver add-in. I started by using the macro
    >> > recorder which generated the following:
    >> >
    >> > Sub SolveForK()
    >> > '
    >> > ' SolveForK Macro
    >> > ' Macro recorded 1/29/2005 by Bill Allen, S.E.
    >> > '
    >> > ' Keyboard Shortcut: Ctrl+Shift+K
    >> > '
    >> > SolverOk SetCell:="$R$5", MaxMinVal:=3, ValueOf:="0",

    > ByChange:="$Q$5"
    >> > SolverSolve
    >> > End Sub
    >> >
    >> > Question 1:
    >> > When I try to execute the code, I get the following error:
    >> >
    >> > With the "SolverOk" highlighted, the error reads:
    >> > ---------------------------
    >> > Microsoft Visual Basic
    >> > ---------------------------
    >> > Compile error:
    >> >
    >> > Sub or Function not defined
    >> > ---------------------------
    >> > OK Help
    >> > ---------------------------
    >> >
    >> > What is wrong with the code? What do I need to fix?
    >> >
    >> > Thanks,
    >> >
    >> > Bill
    >> >
    >> >
    >> >

    >>
    >>

    >
    >




  5. #5
    Ken Wright
    Guest

    Re: Can't find "Solver"

    LOL - Having been there myself once it's one of those things you tend to
    remember. :-)

    --
    Regards
    Ken....................... Microsoft MVP - Excel
    Sys Spec - Win XP Pro / XL 97/00/02/03

    ----------------------------------------------------------------------------
    It's easier to beg forgiveness than ask permission :-)
    ----------------------------------------------------------------------------

    "Bill Allen" <[email protected]> wrote in message
    news:PWSKd.4246$G31.1714@okepread05...
    > Ken -
    >
    > That helps a lot. As you may have suspected, the check box was unchecked.
    >
    > This concept will help when I don't have a code workaround.
    >
    > I hope I remember with that time comes :o).
    >
    > Regards,
    >
    > Bill Allen
    >
    >
    > "Ken Wright" <[email protected]> wrote in message
    > news:[email protected]...
    > > Not necessarily - This one is a bit of a catchall. Take a look in the

    VBA
    > > help files for solver and notice the bit that says
    > >
    > > Before you use this function, you must establish a reference to the

    Solver
    > > add-in. With a Visual Basic module active, click References on the Tools
    > > menu, and then select the Solver.xla check box under Available

    References.
    > > If Solver.xla doesn't appear under Available References, click Browse

    and
    > > open Solver.xla in the \Office\Library\Solver\ subfolder.
    > >
    > > Does that help?
    > >
    > > --
    > > Regards
    > > Ken....................... Microsoft MVP - Excel
    > > Sys Spec - Win XP Pro / XL 97/00/02/03
    > >

    >
    > --------------------------------------------------------------------------

    --
    > > It's easier to beg forgiveness than ask permission :-)

    >
    > --------------------------------------------------------------------------

    --
    > >
    > > "Bill Allen" <[email protected]> wrote in message
    > > news:wDPKd.4227$G31.2529@okepread05...
    > >> Oops. Sent to the wrong group.
    > >>
    > >> Sorry.
    > >>
    > >> "Bill Allen" <[email protected]> wrote in message
    > >> news:8BPKd.4225$G31.2964@okepread05...
    > >> > I'm writing one of my first macros and I would appreciate some help.
    > >> >
    > >> > I am trying to automate the Solver add-in. I started by using the

    macro
    > >> > recorder which generated the following:
    > >> >
    > >> > Sub SolveForK()
    > >> > '
    > >> > ' SolveForK Macro
    > >> > ' Macro recorded 1/29/2005 by Bill Allen, S.E.
    > >> > '
    > >> > ' Keyboard Shortcut: Ctrl+Shift+K
    > >> > '
    > >> > SolverOk SetCell:="$R$5", MaxMinVal:=3, ValueOf:="0",

    > > ByChange:="$Q$5"
    > >> > SolverSolve
    > >> > End Sub
    > >> >
    > >> > Question 1:
    > >> > When I try to execute the code, I get the following error:
    > >> >
    > >> > With the "SolverOk" highlighted, the error reads:
    > >> > ---------------------------
    > >> > Microsoft Visual Basic
    > >> > ---------------------------
    > >> > Compile error:
    > >> >
    > >> > Sub or Function not defined
    > >> > ---------------------------
    > >> > OK Help
    > >> > ---------------------------
    > >> >
    > >> > What is wrong with the code? What do I need to fix?
    > >> >
    > >> > Thanks,
    > >> >
    > >> > Bill
    > >> >
    > >> >
    > >> >
    > >>
    > >>

    > >
    > >

    >
    >




+ 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