Hi ETID, thank you for your quick reply.
Sorry, but I'm not an expert of VBA and my problem is just how to make interact the macro of my program with the solver function. If I launch the solver as I normally do the macro is not runned, so I tried to run the solver function using the following sintax:
The sub Losses Estimation is called by a button in the spreadsheet.
-----------------
Sub Losses_Estimation()
'Clear any previous Solver settings
SolverReset
'Set up the parameters for the model:
SolverOk SetCell:=Range("n37"

, maxMinVal:=2, ByChange:=("c28,g11,AMAIN()"
'Add the constraints for the model.
SolverAdd CellRef:=Range("g11"

, relation:=3, FormulaText:=45
SolverAdd CellRef:=Range("g11"

, relation:=1, FormulaText:=70
SolverAdd CellRef:=Range("c28"

, relation:=1, FormulaText:=g21
'Display the Solver Results dialog
SolverSolve
'Finish and keep the final results
SolverFinish KeepFinal:=1
End Sub
This subroutine performs the calculations
Sub AMAIN()
With Worksheets(3)
PI = 3.1415926
PI2 = PI * 2
N = 101 ' NUMBER OF POINTS IN FI - DIRECTION
'
' GET DATA FOR VANELESS DIFFUSER
'
RO2 = .Cells(12, 3).VALUE
C2 = .Cells(33, 3).VALUE
ALP2 = .Cells(36, 3).VALUE
etc,etc
--------------------
My purpose is that at each step of the solver iteration the sub AMAIN() should be called and runned, while instead it doesn't work.
I don't know how to write the code to get this interaction between the solver and the sub AMAIN().
I hope I've well explained the problem, thak you again.
Fernando