+ Reply to Thread
Results 1 to 5 of 5

Macro to automate Solver

  1. #1
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,725

    Macro to automate Solver

    I have the following macro for updating values using Solver


    Please Login or Register  to view this content.
    I need the macro amended as follows:


    1) I need ValueOf:=72 to refer to cell F1

    2) I need $E$$27 to refer to the last cell in Col D in ByChange:="$E$2:$E$27"


    Your assistance in this regard is most appreciated

    I have also posted on

    https://www.mrexcel.com/board/thread...-code.1176711/

    https://www.myonlinetraininghub.com/...ing-vba#p21541
    Last edited by Howardc1001; 07-18-2021 at 10:14 PM. Reason: Amend Code

  2. #2
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,725

    Re: Macro to automate Solver

    I have figured out all the code, except how to automatically change ValueOf:=72, to refer to cell F1 or its named range Sum_Val


    It would be appreciated if someone could assist me





    Please Login or Register  to view this content.

  3. #3
    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: Macro to automate Solver

    You could try changing the line:

    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    Calling the "Simplex" engine you could use either Engine:=2 or EngineDesc:="Simplex LP" you don't need both even if excel adds both when recording a macro. Excel will also duplicate the Solver Set line.

    so you macro could be simplified to this.

    Please Login or Register  to view this content.

    Alf

  4. #4
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,725

    Re: Macro to automate Solver

    Many thanks for the help Alf

  5. #5
    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: Macro to automate Solver

    You are welcome.

    thanks for feedback and rep

    Alf

+ 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. Macro Sover Loop Help
    By Fiona149 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-02-2014, 08:42 AM
  2. using VBA to paste values obtained with sover.
    By Juddel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-29-2013, 08:39 AM
  3. Macro to autom. display images from URL, resize picture and move and size with cell
    By AshtonMcFish in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-22-2013, 06:38 AM
  4. [SOLVED] VB to autom. Sort / Page Break
    By elgato74 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-19-2009, 11:05 AM
  5. [SOLVED] COUNTIF function to autom. Underline
    By elgato74 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-18-2009, 06:39 AM
  6. autom update cells from WB1 to WB2
    By Bruno01 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-31-2005, 03:28 PM

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