+ Reply to Thread
Results 1 to 3 of 3

Change solver variables in vba

  1. #1
    Registered User
    Join Date
    10-26-2012
    Location
    minnesota
    MS-Off Ver
    Excel 2013
    Posts
    16

    Change solver variables in vba

    I have a VBA Module that pulls data from different areas of a spreadsheet and runs them through solver ,making a binary column of 1's and 0's to get my solution. My question is every time the amount of data it pulls in to solve is different for example one time it may be 20 items then next 200. Is there anyway to edit the solver criteria to reflect that based on the amount of items it brings in for example my binary column is G so instead of always having it as G2:G200 when it only copy's in 75 items it would change it to G2:G75?

    Thanks
    Adam

  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: Change solver variables in vba

    Are you running solver in a loop? As I've not seen you model my suggestion must be a guesstimate but perhaps something like this?

    If you are importing the data for solver to work on say to the A column going from A2 to A?? you could perhaps do like this

    Please Login or Register  to view this content.
    Alf

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

    Re: Change solver variables in vba

    My question is every time the amount of data it pulls in to solve is different for example one time it may be 20 items then next 200.
    Solver isn't good at solving binary problems in general, and solving for 50 binary variables (a quadrillion evaluations), much less 200, is way, way, way to the right of impossible.
    Last edited by shg; 11-11-2016 at 01:50 PM.
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Excel Solver - 2 Variables , Whole Numbers
    By mcp77 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-24-2016, 11:09 AM
  2. [SOLVED] Using Solver with variables in VBA without interacting with the worksheet
    By Ruandi in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-10-2014, 10:07 AM
  3. excel solver binary variables
    By kingkong123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-28-2011, 01:59 PM
  4. Finding a minimum with solver and 3 variables
    By BCITgirl in forum Excel General
    Replies: 2
    Last Post: 12-05-2010, 05:16 AM
  5. Set solver constraints so variables are either 1 OR 0.
    By Gwyndalf in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-13-2006, 08:20 PM
  6. variables in excel solver for vba
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-16-2006, 10:50 AM
  7. [SOLVED] solver and defining all variables different than one another
    By excel_excel_excel in forum Excel General
    Replies: 0
    Last Post: 07-19-2005, 03:05 AM

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