+ Reply to Thread
Results 1 to 2 of 2

Solver Macro giving "Error in Model Message". SetCell not updating after running code.

  1. #1
    Registered User
    Join Date
    07-13-2020
    Location
    United Kingdom
    MS-Off Ver
    2019
    Posts
    1

    Solver Macro giving "Error in Model Message". SetCell not updating after running code.

    Hi everyone,

    Thanks in advance to anyone for their time and help.

    I'm currently working on a minimum variance portfolio optimisation task that needs to re-balance the portfolio every week, based on new weights that are calculated through running solver.

    I must repeat the process 345 times so an automated solver macro would be very helpful.

    The code I've written currently runs but I receive the Solver error message " Error in Model. Please verify that all cells and constraints are valid." In addition, the cell I have set to change to Min (the cell containing the variance) remains the same after running it.

    I have also tried creating a for loop however this also did not work, and after reconsidering I actually prefer being able to run the macro for specific cells instead of the entire data set.

    This is the current version of the code:

    Please Login or Register  to view this content.

    If anyone knows how I can get the Macro running it would be a massive help.

    Many thanks
    Attached Files Attached Files
    Last edited by alansidman; 07-15-2020 at 09:49 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2403 Win 11 Home 64 Bit
    Posts
    23,810

    Re: Solver Macro giving "Error in Model Message". SetCell not updating after running code.

    Code Tags Added
    Your post does not comply with Rule 2 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)

    Also, you have marked this as solved. If that is not the case, then please mark it as unsolved as no one will offer assistance in a solved thread.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ 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. [SOLVED] Code "suddenly" starts giving me error 6 overflow
    By jayherring86 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 11-20-2016, 07:38 AM
  2. Replies: 0
    Last Post: 09-22-2015, 06:09 PM
  3. [SOLVED] Overwrite "Allow Access For..." Security Message When Running Code on Outlook
    By XOR LX in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 10-24-2014, 07:07 AM
  4. [SOLVED] SOLVER "error in model" error from VBA
    By tmallin in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 03-13-2014, 03:04 PM
  5. [SOLVED] emptyRow code giving Compile Error "Variable not defined"
    By colvinb in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-21-2012, 04:34 AM
  6. FileCopy Command Giving "Subscript Out of Range" Error Message
    By Jim Hagan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-15-2005, 02:05 PM
  7. "Clean Me" Macro is giving "#VALUE!" error in the Notes field.
    By Ryan Watkins in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-10-2005, 08:05 PM

Tags for this Thread

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