You are on page 1of 2

Sub calculautolambda()

'

Dim xr As Double

Dim xl As Double

Dim xm As Double

Dim x As Double

Dim a As Double

Dim b As Double

Dim epsilon As Double

Dim i As Integer

Dim j As Integer

j=8

i=8

Do Until Cells(j + 1, 1) = ""

If Cells(i, 13) <> "" Then

espilon = 0.00000000000001

xl = 1E-18

xr = 1

a=0

b=0

Do While (xr - xl) > espilon

xm = (xr + xl) / 2

Cells(i + 1, 14) = xm

a = (1 / (Sqr(xm)))
b = -2 * Log((2.51 / (Cells(i + 1, 10) * Sqr(xm))) + (Cells(i + 1, 12) / 3.71)) / Log(10)

If (a - b) < 0 Then

xr = xm

Else

xl = xm

End If

Loop

Cells(i + 1, 14) = xm

Cells(i + 1, 15) = a

Cells(i + 1, 16) = b

End If

i=i+1

j=j+1

Loop

End Sub

You might also like