Z
zarasandreas
Hello and happy new year. I face some problems while trying to cal
Excel solver through VBA in a Windows XP environment. I have teste
the above mentioned problem in both Office XP and Offixe 2003, bu
the message "Solver: An unexpected internal error occurred, o
available memory was exhausted" appear
One part of the code that i have created is as follows
Sub Minimum_Variance_Portfolio(
Application.ScreenUpdating = Fals
SolverRese
Range("b50006").Selec
Set rng = Range(Selection, Selection.End(xlToRight)
SolverOk SetCell:="$B$50012", MaxMinVal:=2
ValueOf:="0", ByChange:=
rng.Addres
SolverAdd CellRef:=rng.Address, Relation:=3
FormulaText:="0
SolverAdd CellRef:="$B$50016", Relation:=2
FormulaText:="1
SolverOk SetCell:="$B$50012", MaxMinVal:=2
ValueOf:="0", ByChange:=
rng.Addres
SolverSolve UserFinish:=Tru
FrmMinVarianceDescriptive.Sho
Application.ScreenUpdating = Tru
End Su
Following some instructions found on the web i added at the beginnin
of the code the following: Application.Ru
"Solver.xla!Autpen
The problem disappeared and the problem was solved
In another part of my code, the following sub was included
Sub Frontier(
'Calculates the solutions that correspond to the portfolio
falling on the frontie
Range("b50007").Selec
Set rng = Range(Selection, Selection.End(xlToRight)
Step = (WorksheetFunction.Max(rng) - WorksheetFunction.Min(rng))
FrontierPoint
Range("b50300").Selec
Selection.End(xlToRight).Offset(0, 2).End(xlDown).Offset(4
0).Selec
Selection.Value = "E(Rp)
Selection.Offset(0, 1).Value = "StDev(p)
Selection.Offset(1, 0).Value = WorksheetFunction.Min(rng
Selection.Offset(1, 0).Selec
For i = 1 To FrontierPoints +
Set rng = Range(Range("b50006")
Range("b50006").End(xlToRight)
Application.ScreenUpdating = Fals
SolverRese
SolverAdd CellRef:=rng.Address, Relation:=3
FormulaText:="0
SolverAdd CellRef:="$B$50016", Relation:=2
FormulaText:="1
RequiredReturn = Selection.Valu
SolverAdd CellRef:="$B$50011", Relation:=3
FormulaText:=RequiredRetur
SolverOk SetCell:="$B$50012", MaxMinVal:=2
ValueOf:="0", ByChange:=
rng.Addres
SolverSolv
rng.Cop
Destination:=Range("b50300").End(xlDown).Offset(4 + i
Selection.Offset(0, 1).Value
Range("b50013").Valu
Selection.Offset(1, 0).Value = Selection.Value + Ste
Selection.Offset(1, 0).Selec
Next
Selection.ClearContent
End Su
I added the following Application.Ru
"Solver.xla!MenuUpdate" at the beggining of the code bu
the problem was not solved. Any suggestions? Since it worked on th
first part of the code, why it still exists in the second part of th
code
Thanks in advanc
ANdrea
Excel solver through VBA in a Windows XP environment. I have teste
the above mentioned problem in both Office XP and Offixe 2003, bu
the message "Solver: An unexpected internal error occurred, o
available memory was exhausted" appear
One part of the code that i have created is as follows
Sub Minimum_Variance_Portfolio(
Application.ScreenUpdating = Fals
SolverRese
Range("b50006").Selec
Set rng = Range(Selection, Selection.End(xlToRight)
SolverOk SetCell:="$B$50012", MaxMinVal:=2
ValueOf:="0", ByChange:=
rng.Addres
SolverAdd CellRef:=rng.Address, Relation:=3
FormulaText:="0
SolverAdd CellRef:="$B$50016", Relation:=2
FormulaText:="1
SolverOk SetCell:="$B$50012", MaxMinVal:=2
ValueOf:="0", ByChange:=
rng.Addres
SolverSolve UserFinish:=Tru
FrmMinVarianceDescriptive.Sho
Application.ScreenUpdating = Tru
End Su
Following some instructions found on the web i added at the beginnin
of the code the following: Application.Ru
"Solver.xla!Autpen
The problem disappeared and the problem was solved
In another part of my code, the following sub was included
Sub Frontier(
'Calculates the solutions that correspond to the portfolio
falling on the frontie
Range("b50007").Selec
Set rng = Range(Selection, Selection.End(xlToRight)
Step = (WorksheetFunction.Max(rng) - WorksheetFunction.Min(rng))
FrontierPoint
Range("b50300").Selec
Selection.End(xlToRight).Offset(0, 2).End(xlDown).Offset(4
0).Selec
Selection.Value = "E(Rp)
Selection.Offset(0, 1).Value = "StDev(p)
Selection.Offset(1, 0).Value = WorksheetFunction.Min(rng
Selection.Offset(1, 0).Selec
For i = 1 To FrontierPoints +
Set rng = Range(Range("b50006")
Range("b50006").End(xlToRight)
Application.ScreenUpdating = Fals
SolverRese
SolverAdd CellRef:=rng.Address, Relation:=3
FormulaText:="0
SolverAdd CellRef:="$B$50016", Relation:=2
FormulaText:="1
RequiredReturn = Selection.Valu
SolverAdd CellRef:="$B$50011", Relation:=3
FormulaText:=RequiredRetur
SolverOk SetCell:="$B$50012", MaxMinVal:=2
ValueOf:="0", ByChange:=
rng.Addres
SolverSolv
rng.Cop
Destination:=Range("b50300").End(xlDown).Offset(4 + i
Selection.Offset(0, 1).Value
Range("b50013").Valu
Selection.Offset(1, 0).Value = Selection.Value + Ste
Selection.Offset(1, 0).Selec
Next
Selection.ClearContent
End Su
I added the following Application.Ru
"Solver.xla!MenuUpdate" at the beggining of the code bu
the problem was not solved. Any suggestions? Since it worked on th
first part of the code, why it still exists in the second part of th
code
Thanks in advanc
ANdrea