I tried to define multiple (For-Next) loop, but i received the following error.
The code is designed to calculate values in cells (C50:C60), then use this values, to calculate values of cells (D50:D60)
I tried to wrote it in a one code, but i received that error, i tried to wrote it on 2 separates codes, but i still having this error.
Could any one help, Thanks in advance.
The Code is :-
Sub CalculateFs()
For x = 50 To 60
If Cells(x, 2) > 0 Then
Cells(x, 3) = (Abs(Cells(x, 1)) / (Cells(22, 1) * WorksheetFunction.Pi * Cells(22, 3) ^ 2 * 0.25) / Cells(40, 2)) + (Cells(x, 2) / (Cells(22, 1) * WorksheetFunction.Pi * Cells(22, 3) ^ 2 * 0.25))
Else
Cells(x, 3) = Abs(Cells(x, 1)) / (Cells(22, 1) * WorksheetFunction.Pi * Cells(22, 3) ^ 2 * 0.25) / Cells(40, 2)
End If
Next x
For S = 50 To 60
Cells(S, 4) = WorksheetFunction.Min(((95000 / Cells(S, 3)) - (2.5 * Cells(17, 2))), (300 * 252 / Cells(S, 3)), (300), ((94600 / Cells(S, 3)) - (2.5 * Cells(17, 2))))
Next S
End Sub
Note:- The first part of the code (X-Values) is good and has no errors message, but the errors appears always with the second part (S-Values)