Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Solver not Using Constraints when called from VB

I have vb code I am running in excel that calls solver for each row in
a spreadsheet. Sometimes solver works correctly and other times it
runs but ignores the constraints. I am using Microsoft Excel 2002. I
have read that when referencing cells in Solver through VB for
versions after Excel 97 you need to use A1 notation. In my code I am
referencing the cells used in the constraints with variables. Below I
have a small example of some of the code I am using. I am
particularly perplexed because of the intermittent nature of the
problem. Any help would be greatly appreciated.

minCol = "AL"
maxCol = "AM"

SolverReset
SolverOk SetCell:=Range(profitCol & row), MaxMinVal:=1, _
ByChange:=Range(priceCol & row)
SolverOptions MaxTime:=100, Iterations:=100,
Precision:=0.000001, AssumeLinear :=False, StepThru:=False,
Estimates:=1, Derivatives:=1, _ SearchOption:=1, _
IntTolerance:=5, Scaling:=False, Convergence:=0.0001, _
AssumeNonNeg:=False


SolverAdd CellRef:=Range(priceCol & row), Relation:=3, _
FormulaText:=Range(minCol & row)

SolverAdd CellRef:=Range(priceCol & row), Relation:=1, _
FormulaText:=Range(maxCol & row)

SolverAdd CellRef:=Range(qtyCol & row), Relation:=3, _
FormulaText:=0

SolverSolve UserFinish:=True

SolverFinish KeepFinal:=1
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
Solver Ignores Constraints Jerry W. Lewis Excel Discussion (Misc queries) 1 November 17th 07 04:30 AM
Solver Constraints twa14 Excel Discussion (Misc queries) 2 October 13th 07 01:10 PM
Excel Solver constraints Dan Excel Worksheet Functions 1 July 13th 07 03:50 PM
Excel Solver Constraints jcoleman52 Excel Discussion (Misc queries) 2 June 1st 06 08:00 PM
Solver Constraints Rick Excel Discussion (Misc queries) 15 March 9th 05 03:17 PM


All times are GMT +1. The time now is 10:27 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"