+ Reply to Thread
Results 1 to 2 of 2

VBA for Dynamic range Solver generates error-Not variable cells but marked All Diff & Int

  1. #1
    Registered User
    Join Date
    06-03-2021
    Location
    Bhubaneswar, India
    MS-Off Ver
    MS Office 365
    Posts
    1

    VBA for Dynamic range Solver generates error-Not variable cells but marked All Diff & Int

    Hi everyone,
    I need immediate help in solving the below. Thanks in Advance

    I want the solver to set its "by changing variable" (lets say column J) and constraint range depending on the number of rows of another column, lets say B (which is not a by changing variable). The generated solutions of "by changing variable" (column J) should be All different and integer, and should have a higher bound (same as the number of rows of B ). The number of rows in column B changes regularly because it is referenced to another function. The solver range should dynamically change according to B.

    I don't have much experience in VBA but I tried coding in two methods and both of them show the same error.

    But it generates an error saying -" Perhaps some cells that are not variable cells are marked as integer, binary or all different"

    Column J is the "by changing variable". Rows in B column should define the dynamic range of column J. T9 is B rows count value.

    Method 1
    Please Login or Register  to view this content.
    Method 2
    Please Login or Register  to view this content.
    Last edited by AliGW; 06-03-2021 at 07:46 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    79,401

    Re: VBA for Dynamic range Solver generates error-Not variable cells but marked All Diff &

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not provided the required cross-post link(s) here.

    Please see Forum Rule #3 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important.

    (Note: this requirement is not optional. As you are new here, I shall post the link for you today: https://www.mrexcel.com/board/thread...inary.1172746/.)

    Administrative Note:

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. 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, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. As you are new here, I shall do it for you today, however you really do need to take a moment to ready our rules, having broken two of them already in your very first post.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

+ 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] Create a dynamic range for by changing variable cells box in solver
    By Ad896832 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-26-2017, 02:03 PM
  2. Replies: 2
    Last Post: 03-20-2016, 04:54 AM
  3. set variable to 0 if a function generates an error
    By luv2glyd in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-03-2016, 08:43 PM
  4. [SOLVED] Obj Variable or with variable not set error on emailing diff jpg data to diff recipients
    By BigDawg15 in forum Outlook Programming / VBA / Macros
    Replies: 9
    Last Post: 11-16-2014, 12:51 PM
  5. Range Select generates 400 error code
    By BRISBANEBOB in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-17-2013, 02:26 AM
  6. range.offset generates a Run Time error 1004
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-22-2006, 12:50 PM
  7. Dynamic range (object variable error)
    By Mslady in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-01-2005, 04:09 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