I am trying to read data that is columns A5 -> A1000, B5->B1000, and C5->C1000. Then print the values to its respective row in column D. When I run the program through the loop, the program crashes. What am I doing wrong? I am new to VBA so I am on a steep learning curve.
Code:
Option Explicit
Sub DR()
Dim FR As Double
Dim Density As Double
Dim Id As Double
Dim m As Double
Dim length As Double
Dim PDC As Double
Dim PDM As Double
Dim Cff As Double
Dim ReN As Double
Dim pi As Double
Dim V As Double
Dim DR As Double
pi = 3.14159265
FR = Workbooks("Drag Reduction Testing").ActiveSheet.Range("A5")
Do
Density = Workbooks("Drag Reduction Testing").ActiveSheet.Range("b5")
PDM = Workbooks("Drag Reduction Testing").ActiveSheet.Range("c5")
Id = Workbooks("Drag Reduction Testing").ActiveSheet.Range("b1")
m = Workbooks("Drag Reduction Testing").ActiveSheet.Range("b3")
length = Workbooks("Drag Reduction Testing").ActiveSheet.Range("d1")
V = 0.00222800926 * FR / (pi * (Id / 12) ^ 2) * 4
ReN = 928 * V * Id * Density / m
Cff = 0.3164 / ReN ^ 0.25
PDC = Cff * V ^ 2 * Density * length / (25.8 * Id)
DR = (PDM - PDC) / PDC * 100
Range("d5").Value = DR
Loop Until IsEmpty(FR)
End Sub