+ Reply to Thread
Results 1 to 2 of 2

Dynamic variable cells in Solver VBA macro

  1. #1
    Registered User
    Join Date
    06-08-2021
    Location
    Sweden
    MS-Off Ver
    365
    Posts
    1

    Dynamic variable cells in Solver VBA macro

    Hello,

    I have a macro that runs Solver in Excel, it currently uses two different ranges as the variable cells. See the code below.


    Please Login or Register  to view this content.
    Instead of having an absolute reference to $C$7:$I$11, I would want to only select the rows of the range where K7:K11="Unlocked" (note that this is a separate column). Is it possible to achieve in a simple way? I have attempted creating a named range in Excel, but I have so far been unsuccessful. Maybe it's easier to solve within the macro, however my VBA skills are nonexistant.

    Thankful for any help!

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,623

    Re: Dynamic variable cells in Solver VBA macro

    I don't think you can use named ranges in Solver (but just not sure). Anyway, below is proposition to "construct" the address as the text, by checking K row by row and adding to "selection" C:I parts of unlocked rows:

    Please Login or Register  to view this content.
    Best Regards,

    Kaper

+ 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. VBA for Dynamic range Solver generates error-Not variable cells but marked All Diff & Int
    By rohit.patra007 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-03-2021, 07:46 AM
  2. Replies: 9
    Last Post: 07-04-2020, 07:39 PM
  3. Replies: 3
    Last Post: 02-10-2020, 03:06 PM
  4. [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
  5. Replies: 4
    Last Post: 12-13-2015, 04:35 PM
  6. Solver dilemma: can variable cells be filled with string values?
    By ndrobinson in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-04-2012, 01:20 PM
  7. Can Solver enter text/strings into variable cells?
    By ndrobinson in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-19-2012, 04:06 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