[TR]
[TD="class: votecell"][/TD]
[TD="class: postcell"]I am trying to use solver to find the root for 182 cells, each cell is depend only on one another variable, the output cell is from O2 to O183, the variable cell is from P2 to P183. I am trying to change the variable cells to have the output cell equal to 1. The code works but the results does not converge. Because I just want a fixed value of 1, I didn't set MaxMin value. The code is:
[/TD]
[/TR]
</tbody>
[TR]
[TD="class: votecell"]
[TD="class: postcell"][/TD]
[/TR]
<tbody style="px"margin:" 0px;="" padding:="" border:="" 0px;"=""></tbody>
When I use solver function out of VBA it works, but VBA results doesn't converge. Any help is appreciated. Nothing changed after running the Macro.
[TD="class: votecell"][/TD]
[TD="class: postcell"]I am trying to use solver to find the root for 182 cells, each cell is depend only on one another variable, the output cell is from O2 to O183, the variable cell is from P2 to P183. I am trying to change the variable cells to have the output cell equal to 1. The code works but the results does not converge. Because I just want a fixed value of 1, I didn't set MaxMin value. The code is:
[/TD]
[/TR]
</tbody>
[TR]
[TD="class: votecell"]
do
[/TD][TD="class: postcell"][/TD]
[/TR]
<tbody style="px"margin:" 0px;="" padding:="" border:="" 0px;"=""></tbody>
Code:
<code style="margin: 0px; padding: 0px; border: 0px; border-image-source: initial; border-image-slice: initial; border-image-width: initial; border-image-outset: initial; border-image-repeat: initial; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit;">[COLOR=#00008B]Sub[/COLOR][COLOR=#2E3133] Solver[/COLOR][COLOR=#2E3133]()[/COLOR][COLOR=#2E3133]
[/COLOR][COLOR=#00008B]Dim[/COLOR][COLOR=#2E3133] setcellrange [/COLOR][COLOR=#00008B]As[/COLOR][COLOR=#2E3133] Range[/COLOR][COLOR=#2E3133],[/COLOR][COLOR=#2E3133] bychangerange [/COLOR][COLOR=#00008B]As[/COLOR][COLOR=#2E3133] Range
[/COLOR][COLOR=#00008B]Dim[/COLOR][COLOR=#2E3133] i [/COLOR][COLOR=#00008B]As[/COLOR][COLOR=#00008B]Long[/COLOR][COLOR=#2E3133]
[/COLOR][COLOR=#00008B]For[/COLOR][COLOR=#2E3133] i [/COLOR][COLOR=#2E3133]=[/COLOR][COLOR=#6b291b]2[/COLOR][COLOR=#00008B]To[/COLOR][COLOR=#6b291b]183[/COLOR][COLOR=#2E3133]
[/COLOR][COLOR=#00008B]Set[/COLOR][COLOR=#2E3133] setcellrange [/COLOR][COLOR=#2E3133]=[/COLOR][COLOR=#2E3133] Sheets[/COLOR][COLOR=#2E3133]([/COLOR][COLOR=#6B291B]"AshfordPierce"[/COLOR][COLOR=#2E3133]).[/COLOR][COLOR=#2E3133]Cells[/COLOR][COLOR=#2E3133]([/COLOR][COLOR=#2E3133]i[/COLOR][COLOR=#2E3133],[/COLOR][COLOR=#6B291B]15[/COLOR][COLOR=#2E3133])[/COLOR][COLOR=#2E3133]
[/COLOR][COLOR=#00008B]Set[/COLOR][COLOR=#2E3133] bychangerange [/COLOR][COLOR=#2E3133]=[/COLOR][COLOR=#2E3133] Sheets[/COLOR][COLOR=#2E3133]([/COLOR][COLOR=#6B291B]"AshfordPierce"[/COLOR][COLOR=#2E3133]).[/COLOR][COLOR=#2E3133]Cells[/COLOR][COLOR=#2E3133]([/COLOR][COLOR=#2E3133]i[/COLOR][COLOR=#2E3133],[/COLOR][COLOR=#6B291B]16[/COLOR][COLOR=#2E3133])[/COLOR][COLOR=#2E3133]
SolverReset
SolverOk SetCell[/COLOR][COLOR=#2E3133]:=[/COLOR][COLOR=#2E3133]setcellrange[/COLOR][COLOR=#2E3133].[/COLOR][COLOR=#2E3133]Address[/COLOR][COLOR=#2E3133],[/COLOR][COLOR=#2E3133] ValueOf[/COLOR][COLOR=#2E3133]:=[/COLOR][COLOR=#6B291B]1[/COLOR][COLOR=#2E3133],[/COLOR][COLOR=#2E3133] ByChange[/COLOR][COLOR=#2E3133]:=[/COLOR][COLOR=#2E3133]bychangerange[/COLOR][COLOR=#2E3133].[/COLOR][COLOR=#2E3133]Address[/COLOR][COLOR=#2E3133],[/COLOR][COLOR=#2E3133] Engine[/COLOR][COLOR=#2E3133]:=[/COLOR][COLOR=#6B291B]1[/COLOR][COLOR=#2E3133],[/COLOR][COLOR=#2E3133] EngineDesc[/COLOR][COLOR=#2E3133]:=[/COLOR][COLOR=#6B291B]"GRG NONLINEAR"[/COLOR][COLOR=#2E3133]
SolverSolve
[/COLOR][COLOR=#00008B]Next[/COLOR][COLOR=#2E3133] i
[/COLOR][COLOR=#00008B]End[/COLOR][COLOR=#00008B]Sub[/COLOR]</code>