ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Use of constant instead of variable in VBA Solver (https://www.excelbanter.com/excel-programming/445938-use-constant-instead-variable-vba-solver.html)

Skovorodin

Use of constant instead of variable in VBA Solver
 
1 Attachment(s)
Sometimes it is necessary to use a constant instead of variable in VBA Solver. Is there any way to solve the problem? It is described in the file switch.zip with macros.

Skovorodin

Quote:

Originally Posted by Skovorodin (Post 1601389)
Sometimes it is necessary to use a constant instead of variable in VBA Solver. Is there any way to solve the problem? It is described in the file switch.zip with macros.

Let us assume that Cell "$G$19" encloses a variable.
One approach to convert the variable into constant is to use the same value (for example, 1)
SolverAdd CellRef:="$G$19", Relation:=3, FormulaText:="1"
SolverAdd CellRef:="$G$19", Relation:=1, FormulaText:="1"


All times are GMT +1. The time now is 06:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com