ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Solver in macros (https://www.excelbanter.com/excel-programming/345933-solver-macros.html)

traima

Solver in macros
 
How is it possible to create a macro that uses Solver to calculate a target
cell, by changig the value of an inputbox?


So far I have recorded the solver code like this:

SolverOK SetCell:="$H$25", MaxMinVal:=3, ValueOf:=Nettverk, ByChange:="$C$16"

Nettverk is defined as the value of the inputbox. What am I missing to
complete this?

Dana DeLouis[_3_]

Solver in macros
 
Just for feedback, your code worked ok for me using a simple model.

Your code worked ok for me

Sub Demo()
Dim Nettverk
Nettverk = InputBox("Value")
SolverOK SetCell:="H25", MaxMinVal:=3, ValueOf:=Nettverk,
ByChange:="C16"
SolverSolve True
End Sub

This worked ok also:

Sub Demo2()
SolverOK SetCell:="H25", MaxMinVal:=3, ValueOf:=InputBox("Value"),
ByChange:="C16"
SolverSolve True
End Sub


--
Dana DeLouis
Win XP & Office 2003


"Traima" wrote in message
...
How is it possible to create a macro that uses Solver to calculate a
target
cell, by changig the value of an inputbox?


So far I have recorded the solver code like this:

SolverOK SetCell:="$H$25", MaxMinVal:=3, ValueOf:=Nettverk,
ByChange:="$C$16"

Nettverk is defined as the value of the inputbox. What am I missing to
complete this?





All times are GMT +1. The time now is 09:44 AM.

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