out is defined as a Double, as with Eff (the function return value).

lets see the values would be:

STMPSH(pOut.P, pIn.S) returns 1231.03362289933 : Double

pIn.H : 1488.14368430425 : Double

pOut.H : 1292.74450695371 : Double

which if you do the calculations:

numer : 195.399177350541 : Double

denom : 257.110061404928 : Double

these two were used just to see if either the numerator of the Eff or denominator of the Eff calc were causing the overflow.

out : 0.759982617104987 : Double

like I said, if I use F8 in the debugger to step through the code, I get no errors, no problems, everything all hunky-dory. However! If I just run the code, I get the nice "Run Time Error '6': OverFlow!"... so first off why is it only when I run the code, it should also spit the exception when I am steping through, and second.... why is it spitting the exception at all. the numbers are right and the equate out to the ~76% that out is....

Hi, i realy dont know where the error could be. I tried making a function and it worked perfectly, i think you should see if the problem is inside or outside this method. (or just delete de eff=out line and rename the prop as "Out" jajajajaja)

By the way, here's the function i made:

Public Function Eff(pInH As Double, pOutH As Double, STMP As Double) As Double 'Efficiency of the Turbine

Dim out As Double

Dim numer As Double

Dim denom As Double

numer = pInH - pOutH

denom = pInH - STMP

out = numer / denom

Eff = out '(numer / denom) '(pIn.H - pOut.H) / (pIn.H - STMPSH(pOut.P, pIn.S)) * 100

End Function

and when i tried

Eff(1488.14368430425, 1292.74450695371, 1231.03362289933)

it actually returned 0.759982617105007 (wich is preety close from the one you was expecting).

I hope you find the solution soon.

Hasta luego.

Kad