Create a loop in VBA [Closed]

Report
Posts
1
Registration date
Sunday February 18, 2018
Status
Member
Last seen
February 18, 2018
-
I am trying to create a function however unable to progress as i'm stuck with the iteration part. Below are my codes. How do i go about creating the loop? I have tried many options but to no avail. At times, the system stalled on me. :((

Function TADegC(DEN, Temp As Double)
Application.Volatile

T15 = temp - 15
RHO = DEN
RH15 = RHO * 1000

Do
RH15 = RHO15

K0 = 613.9723
K1 = 0
A = 0

alpha15 = (K0 / (RH15 ^ 2)) + (K1 / RH15) + A
VCF15 = Exp((-alpha15 * T15) * (1 + 0.8 * alpha15 * T15))
rho15 = RHO / VCF15
Error = Abs(rho15 - RHO)

Loop until error <= 0.05

TADegC = rho15


End Function

Subscribe To Our Newsletter!

The Best of CCM in Your Inbox

Subscribe To Our Newsletter!