+ Reply to Thread
Results 1 to 4 of 4

Using Solver in a VBA loop

  1. #1
    Registered User
    Join Date
    04-22-2011
    Location
    Boston
    MS-Off Ver
    Excel 2003
    Posts
    1

    Using Solver in a VBA loop

    Hi,
    I just moved to Excel 2011 (from Excel 2004).
    I had a nice simple macro that was just made of a loop calling the solver.
    The idea is to change $R$i to optimize $S$i.
    Here is the code that works with excel 2004.
    Please Login or Register  to view this content.
    The idea is to put "Y' for the lines that need to be solved (so it does not solved for lines already solved).

    Here is the problem, I have: it only solves the last line.

    There is also something strange going on with the solver in general. Everytime I used it, it launches an new app (solver) bouncing in my dock which disappears after a while. Each optimization is reaaaaallly slow. Does it mean that the solver is not run by excel in the background? Did I miss something when I installed the solver?

    Please let me know if I am missing anything obvious or if you have any idea on how to fix the issue.
    Cheers
    Last edited by blitz13; 04-23-2011 at 08:20 AM.

  2. #2
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Using Solver in a VBA loop

    Try this:

    Please Login or Register  to view this content.
    Last edited by shg; 04-23-2011 at 06:25 PM.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    06-21-2011
    Location
    Corning, NY
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Using Solver in a VBA loop

    shg,

    I have a small spreadsheet that I want to implement Excel Solver sequentially down a column. The set column is E and the change column is I. My code is patterned after the code you show above, but it works only for the first line and not afterwards. I don't see the error. The correct values that should appear in column E are shown in column K. Here is the code I am using for my macro:

    Please Login or Register  to view this content.
    Best regards,
    ProfDean
    Attached Files Attached Files
    Last edited by arlu1201; 07-10-2013 at 01:23 PM.

  4. #4
    Registered User
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,164

    Re: Using Solver in a VBA loop

    profdean,

    Welcome to the forum.

    2 points,

    I have added code tags to your post. As per forum rule 3, you need to use them whenever you put any code in your post. Please add them in future. In order to put code tags, either type [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] at the end of it, OR you can highlight your code and click the # icon at the top of your post window.

    Also,

    You need to post your question in a new thread, it's against the forum rules to post a question in the thread of another user. If you create your own thread, any advice will be tailored to your situation so you should include a description of what you've done and are trying to do. Also, if you feel that this thread is particularly relevant to what you are trying to do, you can surely include a link to it in your new thread.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ 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