Problems running Solver from VB: Windows 2000 users?

  • Thread starter Thread starter karamelmu
  • Start date Start date
K

karamelmu

When I run my code the 'Subject to the constraints' gets filled fine
but for some reson 'Set Target Cell' and 'By Chaning Cells' remai
blank. Any idea what might be causing the problem -- could it be som
bug in Windows 2000? Thanks

~~~~~
Sub Program()

SolverOk SetCell:=Range("A1"), MaxMinVal:=1, ValueOf:="0"
ByChange:=Range("B1:B10") ' this is the stuff that gets omitted

SolverAdd CellRef:=Range("e2"), Relation:=2
FormulaText:=Range("C1")
SolverAdd CellRef:=Range("B1:B10"), Relation:=1
FormulaText:=1
SolverAdd CellRef:=Range("B1:B10"), Relation:=3
FormulaText:=0

SolverSolve Userfinish:=True

End Su
 
I am having the same problem - no SetCell and ByChange values. Did you ever
get this resolved?

Thanks
 
I am having the same problem - no SetCell or ByChange values. Did you ever
get this resolved?

Thanks
 
I know that the documentation indicates you can set the SetCell and
ByChange cells to a range. However, if you use the macro recorder to
have XL generate the code, you will find it actually uses the address
of the range.

Don't know if that is relevant to your problem, but you may want to
test it.

SolverOk SetCell:=Range("A1").Address, MaxMinVal:=1, ValueOf:="0", _
ByChange:=Range("B1:B10").Address

For example, I tested another model that was convenient and the
following worked in both versions I tested (2000 and 2003):

Sub testIt()
solverreset
SolverOk SetCell:="$D$1", MaxMinVal:=1, ValueOf:="0", _
ByChange:="$C$1:$C$6"
SolverAdd CellRef:="$C$1:$C$6", Relation:=5, FormulaText:="binary"
SolverAdd CellRef:="$C$7", Relation:=1, FormulaText:="1"
SolverSolve userfinish:=True
End Sub

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 

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

Back
Top