excel solver macro

H

Hannu Rantala

Hello!

I have a problem with macro using excel solver.

VBA doesn't identify solverfunctions as function. I have a reference to
solver.xla. There is no errors, at all there is no reaction for the
functions. If I put a messagebox to sub, it appears and works well.

What is the problem?

Please help!
 
F

Frank Kabel

Hi
you may post the code you're currtnly using and which does not work.
Otherwise it's quite complicated to offer some help :)
 
H

Hannu Rantala

Ok!

I am using a code like this:
Sub Makro1()
SolverReset
SolverOptions AssumeNonNeg:=True
SolverOk SetCell:="B21", MaxMinVal:=3, ValueOf:="0",
ByChange:="B4,B6,B8"
SolverAdd CellRef:="B3", Relation:=2, FormulaText:="B5"
SolverAdd CellRef:="B4", Relation:=2, FormulaText:="B7"
SolverSolve
SolverFinish KeepFinal:=True
End Sub

The problem is actually in the last command SolverFinish. VBA doesn't
react on that command. I should make a macro which iterates several
values. So the text above should be repeated nine times. To tell to
solver what to do with results I should use SolverFinish and then
begin new iterative prosess. If I put msgbox after SolverSolve, it
appear after solverresults-window. And sometimes VBA doesn't identify
any solverfunctions but others it identify allways.

Hannu Rantala
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top