Consulting

Results 1 to 7 of 7

Thread: Solved: Calling the Solver from VBA

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Solved: Calling the Solver from VBA

    Alright. I have a super simple Solver example in the attached workbook. I am solving the Equation 4*X=8.

    I have the initial guess of X = 1 in cell A2 and I have Cell B2 = 4*A2.

    I turned on the Macro recorder and solved the equation. I did not use any of the options. This is just a 'benchmark' to get things going. The following code was generated:
    [VBA]Option Explicit
    Sub Solver1()
    '
    ' Solver1 Macro
    ' Macro recorded 12/7/2009 by Saladsamurai


    SolverOk SetCell:="$B$2", MaxMinVal:=3, ValueOf:="8", ByChange:="$A$2"
    SolverSolve
    End Sub
    [/VBA]

    After viewing the code, I went back and changed the value of A2 (the initial guess) back to 1. I then went into the VBE and clicked on the button.

    I get the error message:



    Could someone explain to me what I am missing?

    Thanks,
    Casey

    EDIT: WrkBk attached
    Last edited by Saladsamurai; 12-07-2009 at 10:52 AM.

Posting Permissions

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