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!
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!