Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel Solver with Macro doesn't work

I have used a solver in Microsoft Excell to find a solution in a
spreadsheet and the solver works and I can get a solution. I have
several similar cases and I have tried to automate this process and I
made a macro to do this.
Here is the Macro:

Sub optimointi()
SolverReset
SolverAdd CellRef:="$BJ$41:$BJ$52", Relation:=1,
FormulaText:="$BG$7"
SolverOk SetCell:="$BH$43", MaxMinVal:=2, ByChange:= _
"$BJ$7,$BP$26:$BP$42"
SolverSolve UserFinish:=True
SolverFinish KeepFinal:=1
End Sub

This macro works alone fine everytime I start it from excell but if I
add anything to a macro before SolverReset statement or if I call it
from another macro it simply doesn't work. I doesn't give any error
message. Strange for me.

Does anybody have any idea what might be reason for this?

Jukka
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default Excel Solver with Macro doesn't work

I have had a somewhat similar problem. Try this:
SOLVER.Auto_open
before the solver reset statement.

"Jukka" wrote:

I have used a solver in Microsoft Excell to find a solution in a
spreadsheet and the solver works and I can get a solution. I have
several similar cases and I have tried to automate this process and I
made a macro to do this.
Here is the Macro:

Sub optimointi()
SolverReset
SolverAdd CellRef:="$BJ$41:$BJ$52", Relation:=1,
FormulaText:="$BG$7"
SolverOk SetCell:="$BH$43", MaxMinVal:=2, ByChange:= _
"$BJ$7,$BP$26:$BP$42"
SolverSolve UserFinish:=True
SolverFinish KeepFinal:=1
End Sub

This macro works alone fine everytime I start it from excell but if I
add anything to a macro before SolverReset statement or if I call it
from another macro it simply doesn't work. I doesn't give any error
message. Strange for me.

Does anybody have any idea what might be reason for this?

Jukka

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Will Excel Solver in Office97 work with Vista? Alan C[_2_] Excel Discussion (Misc queries) 1 December 13th 07 05:50 PM
How do I get Solver to work Graeme Excel Discussion (Misc queries) 6 September 22nd 05 04:33 AM
excel solver macro Hannu Rantala Excel Programming 2 April 5th 04 05:33 AM
macro using excel solver Hannu Rantala Excel Programming 0 April 2nd 04 09:20 AM
Solver won't work in macro, Excel 2002 SP1 Martin[_11_] Excel Programming 0 November 7th 03 07:03 PM


All times are GMT +1. The time now is 03:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"