Can you post the WHOLE code.
From
Sub SomeName()
al the way to the
End Sub
Sub FlowDepth()
' Declare Varriables
Dim Q As Double, Qcfs As Double, Qgpm As Double, S As Double, n As Double, D As Double, r As Double
Dim Rh() As Double, Af() As Double, Alpha() As Double, Pw() As Double, Fh() As Double, apoth() As Double
Dim count As Double
Dim msg As String
'Solicit Information
Q = Application.InputBox(Prompt:="Enter the proposed flow rate :", Title:="FLOW RATE", Type:=1)
If MsgBox("Is the flow enter in G.P.M ?", vbYesNo, "UNITS DEFINED") = vbYes Then
Qgpm = Q
Qcfs = Qgpm * 7.48 * 60
Else
Qcfs = Q
Qgpm = Qcfs / (7.48 * 60)
End If
S = Application.InputBox(Prompt:="Enter the slope of the proposed sewer pipe :", Title:="SLOPE", Type:=1)
If MsgBox("Is the slope " & S & " entered as a percent?", vbYesNo, "SLOPE DEFINED") = vbYes Then
Else
S = S / 100
End If
D = Application.InputBox(Prompt:="Enter the pipe diameter in INCHES :", Title:="PIPE DIAMETER", Type:=1)
r = D / 2
n = Application.InputBox(Prompt:="Enter the material roughness :", Title:="MANNINGS -N- VALUE", Type:=1)
If MsgBox(Prompt:="CONSTANTS ASSIGNED" & vbCrLf & " Flow Rate = " & Qcfs & " cfs" & vbCrLf & " Slope of Pipe = " & S & vbCrLf & "Pipe Diameter = " & D & " Inch" & vbCrLf & " Pipe Roughness = " & n) = vbOK Then
End If
'Establish an array of heights
msg = "This application uses an itterative solution." & vbCrLf
msg = msg + "The user must establish a step size." & vbCrLf
msg = msg + "Please enter the height interval you wish to use" & vbCrLf
msg = msg + "for example if you want every tenth enter 0.1 :"
step = Application.InputBox(Prompt:=msg, Title:="Step Size Establishing", Type:=1)
count = D / step
count = Round(count, 0)
If MsgBox(Prompt:="The number of itteration will be " & count, Buttons:=vbOKOnly) = vbOK Then
Else
End If
'Fill and test array of heights
ReDim Fh(0 To count)
ReDim apoth(0 To count)
For i = 0 To count
Range("A1").Select 'For checking
Fh(i) = step * i
apoth(i) = D - Fh(i)
ActiveCell.Offset(rowoffset:=i, columnoffset:=0).Activate ' print Fh to verify
ActiveCell.Value = Fh(i)
ActiveCell.Offset(rowoffset:=0, columnoffset:=1).Activate
ActiveCell.Value = apoth(i)
Next i
i = 0
ReDim Alpha(0 To count)
ReDim Pw(0 To count)
ReDim Af(0 To count)
ReDim Rh(0 To count)
For i = 0 To count
Alpha(i) = Application.WorksheetFunction.Acos(1 - (Fh(i) / r))
Pw(i) = Alpha(i) * D
Rh(0) = (D / 4) * (1 - Sin(2 * Alpha(i)) / (2 * Alpha(i)))
Af(i) = Rh(i) * Pw(i)
Range("C1").Select
ActiveCell.Offset(rowoffset:=i, columnoffset:=0).Activate
ActiveCell.Value = Alpha(i)
Next i
End Sub