Using VBA and solver to fill a 10x10 table of values

red987

New Member
Joined
Sep 2, 2016
Messages
1
I'm trying to use VBA and solver to fill a 10x10 table of values. (I am a complete beginner to both VBA and these forums, so I apologize in advance for my inevitable blunder in this post.)

My solutions table has years in Column A (A3:A12) and percentages in Row 2 (B2:L2). There is a vlookup table with some calculations further right on the same sheet (Q4:AC36). The table is set up so that the year of interest needs to be put in cell Q2 and the percentage of interest in cell T2. I then run Solver with the following inputs:

Set Objective Cell: $Y$35
To: Min
By Changing Variable Cells: $X$2
Subject to the Constraints: $X$2 >= 0
Make Unconstrained Variables Non-Negative: Yes
Select a Solving Method: GRG Nonlinear

The value in cell X2 is my solution for the Year and Percentage of interest, and I want to copy that value and paste it into the appropriate cell in my solutions table. For instance, B3 is the solution (value of X2 after running solver) of using inputs A3 (in cell Q2) and B2 (in cell T2). I then want to repeat this same process for all possible combinations of (A3:A12) and (B2:L2) until the table is full.

Any guidance would be greatly appreciated!
 

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top