How move calculations 5 rows over until no values to calculate?

ggilzow

New Member
Joined
May 25, 2011
Messages
10
Code:
Sub DR1()
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
Dim pvOffset As Integer

pi = 3.14159265

'Set FR = Range("A6")
pvOffset = 6

FR = Cells(pvOffset, 1)
Do Until FR = 0
Density = Cells(pvOffset, 3)
PDM = Cells(pvOffset, 4)
Id = Range("b2")
m = Range("b4")
length = Range("d2")
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) / 4
DR = (-PDM + PDC) / PDC * 100
Cells(pvOffset, 5).Value = DR
pvOffset = pvOffset + 1
FR = Cells(pvOffset, 1)
Loop

End Sub

I am trying to figure out how to move the calculation 5 columns to the right after it has finished calculating the first set of calculations. Then stop calculating if there are no values to calculate on the new set of data.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Forum statistics

Threads
1,224,616
Messages
6,179,908
Members
452,949
Latest member
beartooth91

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top