+ Reply to Thread
Results 1 to 2 of 2

Solver VBA Macro

  1. #1
    Registered User
    Join Date
    12-12-2010
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    1

    Solver VBA Macro

    I wrote a macro in order to solver some optimization problems. In general it works very well when the application runs up to 8 times.
    When I try to solve problems where it is required to repeat the application in between 25 and up to 48 times, I face problems. Excel freezes.

    Firstly, the first 10 solutions are found very quickly, up to one minute each, then the macro starts slowing down and it solves each problem at an average of 2- 5 minutes. This increase toward the end up to 10 minutes. Why?

    Also this problem creates other problems to the spreadsheet. When I use the spreadsheet after run the macro, everything is low including moving between cells.
    I suspect that while running the macro some data is stored in the spreadsheet and that is the problem.
    Grateful if you could help me.

    Elio

    The Macro with 8 repeated problem is the following (this repeats 8 times)


    Please Login or Register  to view this content.
    Last edited by davesexcel; 12-12-2010 at 09:18 AM. Reason: code tags required, why not read the rules?

  2. #2
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Solver VBA Macro

    Excel has a nasty habit of hogging memory, could this be your problem? Have you tried to shut down and restart Excel when it gets sluggish to see if this helps?

    If possible post you workbook so somebody else can have a go at it.

    You could also change your code a bit as using "Select" is not so efficient, so instead of:
    Please Login or Register  to view this content.
    try:
    Please Login or Register  to view this content.

+ 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