I forgot the actual code in my original post -- I added it below (I don't
expect the actual code will help to determine what the issue is as I believe
the issue has to do with simply selecting another app while the Solver code
is running)
-----------------------------
Hi,
When running the following Solver code, the error directly below comes up
when I click on another application while Solver is running (ie - If I go to
Internet Explorer while this code is running, after a few seconds, the error
below comes up):
Error:
"No return or halt function found on macro sheet"
I then click on "OK", with is the only button within the error popup menu,
and the code continues, seemingly without any damage being done.
Actual Solver code:
'Set ranges to be used in Solver
Sheets("Transaction Summary").Activate
.Range("L1").ClearContents
'Set commission range
ActiveWorkbook.Names.Add Name:="payfclearcomm", _
RefersToR1C1:=.Range(.Range("L1").End(xlDown), .Range("L65536").End(xlUp))
'Set binary range
ActiveWorkbook.Names.Add Name:="payfclearbin", _
RefersToR1C1:=.Range(.Range("AA1").End(xlDown).Offset(0, 1),
.Range("AA65536").End(xlUp).Offset(0, 1))
'Set month weight range
.Range("A1").End(xlDown).Offset(0, 28).Value = 1
If .Range("O1").End(xlDown).Offset(0, 12).Value <> 1 Then
With .Range(.Range("A1").End(xlDown).Offset(1, 28),
.Range("O1").End(xlDown).Offset(0, 12))
.Formula = _
"=IF(MONTH(RC[-16])<>MONTH(R[-1]C[-16]),1+R[-1]C,R[-1]C)"
.Formula = .Value
End With
Else
End If
ActiveWorkbook.Names.Add Name:="payfclearmonth", _
RefersToR1C1:=.Range(.Range("AA1").End(xlDown).Offset(0, 2),
.Range("AA65536").End(xlUp).Offset(0, 2))
'Set sumif for Forward Balance total
.Range("AD1").Formula = _
"=SUMIF(Linkpayholdclear!C[-23],Linkpayhold!R[1]C[-18],Linkpayholdclear!C[
-28])"
'Set format of cell AD1
.Range("AD1").NumberFormat = "0.00000"
'Set commission sumproduct
.Range("AE1").Formula = "=SUMPRODUCT(payfclearcomm,payfclearbin)"
'Set month weight sumproduct
.Range("AF1").Formula = "=SUMPRODUCT(payfclearbin,payfclearmonth)"
'Solver execution
Sheets("Transaction Summary").Activate
SolverReset
Application.DisplayAlerts = False
SolverOk SetCell:="$AF$1", MaxMinVal:=2, ValueOf:="0",
ByChange:="payfclearbin"
SolverAdd CellRef:="payfclearbin", Relation:=5, FormulaText:="binary"
SolverAdd CellRef:="$AE$1", Relation:=2, FormulaText:="$AD$1"
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
SolverSolve userfinish:=True
Application.DisplayAlerts = True
I did some research on this error, but only found an article saying that
this error comes up in Excel2000 -- I, however, am using Excel2003. The
article instructs that in order "To resolve this problem, obtain the latest
service pack for Microsoft Office 2000". Since I'm using Excel2003, I'm
assuming that the specific issue causing this error that this article refers
to was resolved in Excel2003 and therefore an Excel2003 servicepack wouldn't
address the issue I'm encountering -- is this a bad assumption?
Any help is appreciated!
Robert
--
Robert
robs3131 said:
Hi,
When running the following Solver code, the error directly below comes up
when I click on another application while Solver is running (ie - If I go to
Internet Explorer while this code is running, after a few seconds, the error
below comes up):
"No return or halt function found on macro sheet"
I then click on "OK", with is the only button within the error popup menu,
and the code continues, seemingly without any damage being done.
I did some research on this error, but only found an article saying that
this error comes up in Excel2000 -- I, however, am using Excel2003. The
article instructs that in order "To resolve this problem, obtain the latest
service pack for Microsoft Office 2000". Since I'm using Excel2003, I'm
assuming that the specific issue causing this error that this article refers
to was resolved in Excel2003 and therefore an Excel2003 servicepack wouldn't
address the issue I'm encountering -- is this a bad assumption?
Any help is appreciated!
Robert