View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dana DeLouis Dana DeLouis is offline
external usenet poster
 
Posts: 947
Default Error when running Solver ("No return or halt function found..

ActiveWorkbook.Names.Add Name:="payfclearbin", _
RefersToR1C1:=.Range(.Range("AA1").End(xlDown)
ByChange:="payfclearbin"


Hi. I'm having a problem with my news reader, so hopefully this isn't
posted twice.
These are probably not the issue, but I'll throw it out anyway.
When you write code with .End(xlDown), there is no error check.
Solver is limited to 200 changing cells.
So, as it stands, one can not verify how many cells are set.

Sheets("Transaction Summary").Activate


Most likely not a problem here, but certain operations with solver will
cause an error if the workbook, or worksheet name has a space in it.
Try renaming your workbook/worksheet by removing any space characters.

SolverAdd CellRef:="$AE$1", Relation:=2, FormulaText:="$AD$1"


You are trying to set two complex functions equal to each other.
In general, it is sometimes best to have a constant on the right hand side.
Instead of f(x) = f(y)
it can sometimes be better to re-write it as
f(x) - f(y) = 0.

SolverOk SetCell:="$AF$1", MaxMinVal:=2, ValueOf:="0",


As a note, you can drop the "ValueOf" since it is ignored in a Min problem.

Application.DisplayAlerts = False


Try removing "Application.DisplayAlerts" for now while testing.

Again, just some ideas.
Good luck.
--
HTH :)
Dana DeLouis



robs3131 wrote:
Hi Dana,

I removed the "R1C1", but that didn't fix the error. What's wierd is that I
just realized that as soon as I click on the button (which calls code that
eventually calls the Solver code), if I then click on another application,
Excel freezes up.

I have no idea why this is happening. The code is lengthy, but it starts as
follows - please let me know if you have any idea why this is happening.

Private Sub transclearbyaff_Click()

Dim cjmod As Integer
Dim linkperfmod As Integer
Dim strproceed As String

Application.ScreenUpdating = False

ThisWorkbook.Activate