I can run solver fine in the spreadsheet manually (Excel 2000 SP-3), bu
I am having the same issue with regards to VBA. Below is the code
wrote:
Dim I As Integer
Dim DesiredVal As Range
Set DesiredVal = Range("OutputOCext")
Dim TargetCell As Range
For I = 1 To 228
Set TargetCell = DesiredVal.Cells(1, 1).Offset(I - 1, 3)
If DesiredVal.Cells(I) > 0 Then
SolverReset
SolverOk SetCell:=TargetCell.Address, MaxMinVal:=3
ValueOf:=TargetCell.Offset(0, -3).Value, ByChange:=TargetCell.Offset(0
-1).Address
SolverReset
SolverOk SetCell:=TargetCell.Address, MaxMinVal:=3
ValueOf:=TargetCell.Offset(0, -3).Value, ByChange:=TargetCell.Offset(0
-1).Address
SolverSolve UserFinish:=True
SolverFinish keepFinal:=1
If TargetCell.Offset(0, -1).Value < 0 Then
TargetCell.Offset(0, -1).Value = 0
SolverReset
SolverOk SetCell:=TargetCell.Address, MaxMinVal:=3
ValueOf:=TargetCell.Offset(0, -3).Value, ByChange:=TargetCell.Offset(0
-2).Address
SolverReset
SolverOk SetCell:=TargetCell.Address, MaxMinVal:=3
ValueOf:=TargetCell.Offset(0, -3).Value, ByChange:=TargetCell.Offset(0
-2).Address
SolverSolve UserFinish:=True
SolverFinish keepFinal:=1
End If
Else
TargetCell.Offset(0, -1).Value = 0
TargetCell.Offset(0, -2).Value = 0
End If
Next I
This works perfectly in Excel 2003 and in Excel 2000 (basic install
but with Excel 2000 SP-3 it does not. One thing I noticed is that i
the with Excel 2000 SP-3 if you open up solver after the macro runs
the "SetCell" and "ByChangingCell" boxes are not populated while the
are in the other versions of Excel for the last solution solve
performed. Apparently these references are not making it into thes
boxes with SP-3.
Also am using windows XP SP-2.
Does anybody know of a fix?
thanks,
Lauri