Você está na página 1de 17

Sub rectangulo_calcular()

ListBox1.Visible = True
ListBox2.Visible = True
ListBox1.Clear
ListBox2.Clear
Range("B6").Select
ActiveCell.FormulaR1C1 = " "
Range("B7").Select
ActiveCell.FormulaR1C1 = " "
Range("B8").Select
ActiveCell.FormulaR1C1 = " "
Range("B9").Select
ActiveCell.FormulaR1C1 = " "
Range("C6").Select
ActiveCell.FormulaR1C1 = " "
Range("C7").Select
ActiveCell.FormulaR1C1 = " "
Range("C8").Select
ActiveCell.FormulaR1C1 = " "
Range("C9").Select
ActiveCell.FormulaR1C1 = " "
Range("B15").Select
ActiveCell.FormulaR1C1 = " "
Range("C15").Select
ActiveCell.FormulaR1C1 = " "
Range("B13").Select
ActiveCell.FormulaR1C1 = " "
Range("C13").Select
ActiveCell.FormulaR1C1 = " "
Range("B14").Select
ActiveCell.FormulaR1C1 = " "
Range("C14").Select
ActiveCell.FormulaR1C1 = " "
Range("B10").Select
ActiveCell.FormulaR1C1 = " "
Range("C10").Select
ActiveCell.FormulaR1C1 = " "
Range("B11").Select
ActiveCell.FormulaR1C1 = " "
Range("C11").Select
ActiveCell.FormulaR1C1 = " "
Range("B12").Select
ActiveCell.FormulaR1C1 = " "
Range("C12").Select
ActiveCell.FormulaR1C1 = " "

Do
Q = Val(InputBox("Ingrese el valor del caudal (Q) teniendo en cuenta que tiene que
ser mayor que 0"))
S = Val(InputBox("Ingrese el valor de la pendiente(S) teniendo en cuenta que tiene
que ser mayor que 0"))
n = Val(InputBox("Ingrese el valor del coeficiente de rugosidad(n) teniendo en
cuenta que tiene que ser mayor que 0"))
b = Val(InputBox("Ingrese el valor del Ancho de la solera (b) teniendo en cuenta
que tiene que ser mayor que 0"))

Loop Until (Q > 0) And (S > 0) And (n > 0) And (b > 0)

Range("B6").Select
ActiveCell.FormulaR1C1 = "Caudal = "
Range("B7").Select
ActiveCell.FormulaR1C1 = "Pendiente = "
Range("B8").Select
ActiveCell.FormulaR1C1 = "Coeficiente de rugosidad de Manning = "
Range("B9").Select
ActiveCell.FormulaR1C1 = "Base = "
Range("C6").Select
ActiveCell.FormulaR1C1 = Q
Range("C7").Select
ActiveCell.FormulaR1C1 = S
Range("C8").Select
ActiveCell.FormulaR1C1 = n
Range("C9").Select
ActiveCell.FormulaR1C1 = b

eh = (Q * n) / (S ^ (1 / 2))

Range("B15").Select
ActiveCell.FormulaR1C1 = "Elemento hidr�ulico = "
Range("C15").Select
ActiveCell.FormulaR1C1 = FormatNumber(eh, 4)

Do

yn = Val(InputBox("Ingrese el valor del Tirante Normal (Yn) Nota: El valor debe ser
mayor a 0", "Valor de la tirante normal", , 10000, 5000))

a = b * yn
rh = a / (b + 2 * yn)
eg = ((rh) ^ (2 / 3)) * a
Range("H11").Select
ListBox1.AddItem FormatNumber(yn, 4)
ListBox2.AddItem FormatNumber(eg, 4)
If (FormatNumber(eh, 4) = FormatNumber(eg, 4)) Then
resultado = MsgBox("El valor de Yn es =" & yn & vbNewLine & "Con un
resultado de =" & eh, vbOKCancel)
If (resultado = vbOK) Or (resultado = vbCancel) Then
Range("B13").Select
ActiveCell.FormulaR1C1 = "Tirante Normal"
Range("C13").Select
ActiveCell.FormulaR1C1 = FormatNumber(yn, 3)

Vn = (1 / n) * (((b * yn) / (b + 2 * yn)) ^ (2 / 3)) * (S ^ (1 / 2))


Range("B14").Select
ActiveCell.FormulaR1C1 = "Velocidad Normal = "
Range("C14").Select
ActiveCell.FormulaR1C1 = FormatNumber(Vn, 3)
End
End If
Else
If (FormatNumber(eh, 4) > FormatNumber(eg, 4)) Then
MsgBox ("Ingrese un valor mayor de Yn")
Else
MsgBox ("Ingrese un valor menor de Yn")
End If
End If
Loop Until (FormatNumber(eh, 4) = FormatNumber(eg, 4))

End Sub
Private Sub CommandButton1_Click()
rectangulo_calcular
End Sub

Private Sub CommandButton2_Click()


ListBox1.Visible = False
ListBox2.Visible = False
ListBox1.Clear
ListBox2.Clear
Range("B6").Select
ActiveCell.FormulaR1C1 = " "
Range("B7").Select
ActiveCell.FormulaR1C1 = " "
Range("B8").Select
ActiveCell.FormulaR1C1 = " "
Range("B9").Select
ActiveCell.FormulaR1C1 = " "
Range("C6").Select
ActiveCell.FormulaR1C1 = " "
Range("C7").Select
ActiveCell.FormulaR1C1 = " "
Range("C8").Select
ActiveCell.FormulaR1C1 = " "
Range("C9").Select
ActiveCell.FormulaR1C1 = " "
Range("B15").Select
ActiveCell.FormulaR1C1 = " "
Range("C15").Select
ActiveCell.FormulaR1C1 = " "
Range("B13").Select
ActiveCell.FormulaR1C1 = " "
Range("C13").Select
ActiveCell.FormulaR1C1 = " "
Range("B14").Select
ActiveCell.FormulaR1C1 = " "
Range("C14").Select
ActiveCell.FormulaR1C1 = " "
Range("B10").Select
ActiveCell.FormulaR1C1 = " "
Range("C10").Select
ActiveCell.FormulaR1C1 = " "
Range("B11").Select
ActiveCell.FormulaR1C1 = " "
Range("C11").Select
ActiveCell.FormulaR1C1 = " "
Range("B12").Select
ActiveCell.FormulaR1C1 = " "
Range("C12").Select
ActiveCell.FormulaR1C1 = " "
End Sub

Sub trapecio_calcular()
ListBox1.Visible = False
ListBox2.Visible = False
ListBox1.Clear
ListBox2.Clear
Range("B6").Select
ActiveCell.FormulaR1C1 = " "
Range("B7").Select
ActiveCell.FormulaR1C1 = " "
Range("B8").Select
ActiveCell.FormulaR1C1 = " "
Range("B9").Select
ActiveCell.FormulaR1C1 = " "
Range("C6").Select
ActiveCell.FormulaR1C1 = " "
Range("C7").Select
ActiveCell.FormulaR1C1 = " "
Range("C8").Select
ActiveCell.FormulaR1C1 = " "
Range("C9").Select
ActiveCell.FormulaR1C1 = " "
Range("B15").Select
ActiveCell.FormulaR1C1 = " "
Range("C15").Select
ActiveCell.FormulaR1C1 = " "
Range("B13").Select
ActiveCell.FormulaR1C1 = " "
Range("C13").Select
ActiveCell.FormulaR1C1 = " "
Range("B14").Select
ActiveCell.FormulaR1C1 = " "
Range("C14").Select
ActiveCell.FormulaR1C1 = " "
Range("B10").Select
ActiveCell.FormulaR1C1 = " "
Range("C10").Select
ActiveCell.FormulaR1C1 = " "
Range("B11").Select
ActiveCell.FormulaR1C1 = " "
Range("C11").Select
ActiveCell.FormulaR1C1 = " "
Range("B12").Select
ActiveCell.FormulaR1C1 = " "
Range("C12").Select
ActiveCell.FormulaR1C1 = " "
Do
Q = Val(InputBox("Ingrese el valor del caudal (Q) teniendo en cuenta que tiene que
ser mayor que 0"))
S = Val(InputBox("Ingrese el valor de la pendiente(S) teniendo en cuenta que tiene
que ser mayor que 0"))
n = Val(InputBox("Ingrese el valor del coeficiente de rugosidad(n) teniendo en
cuenta que tiene que ser mayor que 0"))
b = Val(InputBox("Ingrese el valor del Ancho de la solera (b) teniendo en cuenta
que tiene que ser mayor que 0"))
Z = Val(InputBox("Ingrese el valor del talud (z) teniendo en cuenta que tiene que
ser mayor que 0"))
Loop Until (Q > 0) And (S > 0) And (n > 0) And (b > 0) And (Z > 0)

Range("B6").Select
ActiveCell.FormulaR1C1 = "Caudal = "
Range("B7").Select
ActiveCell.FormulaR1C1 = "Pendiente = "
Range("B8").Select
ActiveCell.FormulaR1C1 = "Coeficiente de rugosidad de Manning = "
Range("B9").Select
ActiveCell.FormulaR1C1 = "Base = "
Range("B10").Select
ActiveCell.FormulaR1C1 = "Talud = "
Range("C6").Select
ActiveCell.FormulaR1C1 = Q
Range("C7").Select
ActiveCell.FormulaR1C1 = S
Range("C8").Select
ActiveCell.FormulaR1C1 = n
Range("C9").Select
ActiveCell.FormulaR1C1 = b
Range("C10").Select
ActiveCell.FormulaR1C1 = Z

eh = (Q * n) / (S ^ (1 / 2))

Range("B15").Select
ActiveCell.FormulaR1C1 = "Elemento hidr�ulico = "
Range("C15").Select
ActiveCell.FormulaR1C1 = FormatNumber(eh, 4)

Do

yn = Val(InputBox("Ingrese el valor del Tirante Normal (Yn) Nota: El valor debe ser
mayor a 0", "Valor de la tirante normal", , 10000, 5000))

a = (b + Z * yn) * yn
p = b + 2 * yn * ((1 + Z ^ 2) ^ (0.5))
rh = a / p
eg = ((rh) ^ (2 / 3)) * a
Range("H11").Select
ListBox1.AddItem FormatNumber(yn, 4)
ListBox2.AddItem FormatNumber(eg, 4)
If (FormatNumber(eh, 4) = FormatNumber(eg, 4)) Then
resultado = MsgBox("El valor de Yn es =" & yn & vbNewLine & "Con un
resultado de =" & eh, vbOKCancel)
If (resultado = vbOK) Or (resultado = vbCancel) Then
Range("B13").Select
ActiveCell.FormulaR1C1 = "Tirante Normal"
Range("C13").Select
ActiveCell.FormulaR1C1 = FormatNumber(yn, 3)
Vn = (1 / n) * (((b * yn) / (b + 2 * yn)) ^ (2 / 3)) * (S ^ (1 / 2))
Range("B14").Select
ActiveCell.FormulaR1C1 = "Velocidad Normal = "
Range("C14").Select
ActiveCell.FormulaR1C1 = FormatNumber(Vn, 3)
End
End If
Else
If (FormatNumber(eh, 4) > FormatNumber(eg, 4)) Then
MsgBox ("Ingrese un valor mayor de Yn")
Else
MsgBox ("Ingrese un valor menor de Yn")
End If
End If
Loop Until (FormatNumber(eh, 4) = FormatNumber(eg, 4))

End Sub

Private Sub CommandButton3_Click()


trapecio_calcular
End Sub

Sub triangulo_calcular()
ListBox1.Visible = True
ListBox2.Visible = True
ListBox1.Clear
ListBox2.Clear
Range("B6").Select
ActiveCell.FormulaR1C1 = " "
Range("B7").Select
ActiveCell.FormulaR1C1 = " "
Range("B8").Select
ActiveCell.FormulaR1C1 = " "
Range("B9").Select
ActiveCell.FormulaR1C1 = " "
Range("C6").Select
ActiveCell.FormulaR1C1 = " "
Range("C7").Select
ActiveCell.FormulaR1C1 = " "
Range("C8").Select
ActiveCell.FormulaR1C1 = " "
Range("C9").Select
ActiveCell.FormulaR1C1 = " "
Range("B15").Select
ActiveCell.FormulaR1C1 = " "
Range("C15").Select
ActiveCell.FormulaR1C1 = " "
Range("B13").Select
ActiveCell.FormulaR1C1 = " "
Range("C13").Select
ActiveCell.FormulaR1C1 = " "
Range("B14").Select
ActiveCell.FormulaR1C1 = " "
Range("C14").Select
ActiveCell.FormulaR1C1 = " "
Range("B10").Select
ActiveCell.FormulaR1C1 = " "
Range("C10").Select
ActiveCell.FormulaR1C1 = " "
Range("B11").Select
ActiveCell.FormulaR1C1 = " "
Range("C11").Select
ActiveCell.FormulaR1C1 = " "
Range("B12").Select
ActiveCell.FormulaR1C1 = " "
Range("C12").Select
ActiveCell.FormulaR1C1 = " "
Do
Q = Val(InputBox("Ingrese el valor del caudal (Q) teniendo en cuenta que tiene que
ser mayor que 0"))
S = Val(InputBox("Ingrese el valor de la pendiente(S) teniendo en cuenta que tiene
que ser mayor que 0"))
n = Val(InputBox("Ingrese el valor del coeficiente de rugosidad(n) teniendo en
cuenta que tiene que ser mayor que 0"))
Z = Val(InputBox("Ingrese el valor del talud (z) teniendo en cuenta que tiene que
ser mayor que 0"))
Loop Until (Q > 0) And (S > 0) And (n > 0) And (Z > 0)

Range("B6").Select
ActiveCell.FormulaR1C1 = "Caudal = "
Range("B7").Select
ActiveCell.FormulaR1C1 = "Pendiente = "
Range("B8").Select
ActiveCell.FormulaR1C1 = "Coeficiente de rugosidad de Manning = "
Range("B9").Select
ActiveCell.FormulaR1C1 = "Talud = "
Range("C6").Select
ActiveCell.FormulaR1C1 = Q
Range("C7").Select
ActiveCell.FormulaR1C1 = S
Range("C8").Select
ActiveCell.FormulaR1C1 = n
Range("C9").Select
ActiveCell.FormulaR1C1 = Z

eh = (Q * n) / (S ^ (1 / 2))

Range("B15").Select
ActiveCell.FormulaR1C1 = "Elemento hidr�ulico = "
Range("C15").Select
ActiveCell.FormulaR1C1 = FormatNumber(eh, 4)

Do

yn = Val(InputBox("Ingrese el valor del Tirante Normal (Yn) Nota: El valor debe ser
mayor a 0", "Valor de la tirante normal", , 10000, 5000))

a = Z * yn ^ 2
p = 2 * yn * Sqr(1 + Z ^ 2)
rh = a / p
eg = ((rh) ^ (2 / 3)) * a
Range("H11").Select
ListBox1.AddItem FormatNumber(yn, 4)
ListBox2.AddItem FormatNumber(eg, 4)
If (FormatNumber(eh, 4) = FormatNumber(eg, 4)) Then
resultado = MsgBox("El valor de Yn es =" & yn & vbNewLine & "Con un
resultado de =" & eh, vbOKCancel)
If (resultado = vbOK) Or (resultado = vbCancel) Then
Range("B13").Select
ActiveCell.FormulaR1C1 = "Tirante Normal"
Range("C13").Select
ActiveCell.FormulaR1C1 = FormatNumber(yn, 3)
Vn = (1 / n) * (((b * yn) / (b + 2 * yn)) ^ (2 / 3)) * (S ^ (1 / 2))
Range("B14").Select
ActiveCell.FormulaR1C1 = "Velocidad Normal = "
Range("C14").Select
ActiveCell.FormulaR1C1 = FormatNumber(Vn, 3)
End
End If
Else
If (FormatNumber(eh, 4) > FormatNumber(eg, 4)) Then
MsgBox ("Ingrese un valor mayor de Yn")
Else
MsgBox ("Ingrese un valor menor de Yn")
End If
End If
Loop Until (FormatNumber(eh, 4) = FormatNumber(eg, 4))

End Sub

Private Sub CommandButton4_Click()


triangulo_calcular
End Sub

Sub circular_calcular()
ListBox1.Visible = True
ListBox2.Visible = True
ListBox1.Clear
ListBox2.Clear
Range("B6").Select
ActiveCell.FormulaR1C1 = " "
Range("B7").Select
ActiveCell.FormulaR1C1 = " "
Range("B8").Select
ActiveCell.FormulaR1C1 = " "
Range("B9").Select
ActiveCell.FormulaR1C1 = " "
Range("C6").Select
ActiveCell.FormulaR1C1 = " "
Range("C7").Select
ActiveCell.FormulaR1C1 = " "
Range("C8").Select
ActiveCell.FormulaR1C1 = " "
Range("C9").Select
ActiveCell.FormulaR1C1 = " "
Range("B15").Select
ActiveCell.FormulaR1C1 = " "
Range("C15").Select
ActiveCell.FormulaR1C1 = " "
Range("B13").Select
ActiveCell.FormulaR1C1 = " "
Range("C13").Select
ActiveCell.FormulaR1C1 = " "
Range("B14").Select
ActiveCell.FormulaR1C1 = " "
Range("C14").Select
ActiveCell.FormulaR1C1 = " "
Range("B10").Select
ActiveCell.FormulaR1C1 = " "
Range("C10").Select
ActiveCell.FormulaR1C1 = " "
Range("B11").Select
ActiveCell.FormulaR1C1 = " "
Range("C11").Select
ActiveCell.FormulaR1C1 = " "
Range("B12").Select
ActiveCell.FormulaR1C1 = " "
Range("C12").Select
ActiveCell.FormulaR1C1 = " "
Do
Q = Val(InputBox("Ingrese el valor del caudal (Q) teniendo en cuenta que tiene que
ser mayor que 0"))
S = Val(InputBox("Ingrese el valor de la pendiente(S) teniendo en cuenta que tiene
que ser mayor que 0"))
n = Val(InputBox("Ingrese el valor del coeficiente de rugosidad(n) teniendo en
cuenta que tiene que ser mayor que 0"))
d = Val(InputBox("Ingrese el valor del di�metro (d) teniendo en cuenta que tiene
que ser mayor que 0"))
Loop Until (Q > 0) And (S > 0) And (n > 0) And (d > 0)

Range("B6").Select
ActiveCell.FormulaR1C1 = "Caudal = "
Range("B7").Select
ActiveCell.FormulaR1C1 = "Pendiente = "
Range("B8").Select
ActiveCell.FormulaR1C1 = "Coeficiente de rugosidad de Manning = "
Range("B9").Select
ActiveCell.FormulaR1C1 = "Di�metro = "
Range("C6").Select
ActiveCell.FormulaR1C1 = Q
Range("C7").Select
ActiveCell.FormulaR1C1 = S
Range("C8").Select
ActiveCell.FormulaR1C1 = n
Range("C9").Select
ActiveCell.FormulaR1C1 = d

eh = (Q * n) / (S ^ (1 / 2))

Range("B15").Select
ActiveCell.FormulaR1C1 = "Elemento hidr�ulico = "
Range("C15").Select
ActiveCell.FormulaR1C1 = FormatNumber(eh, 4)

Do
yn = Val(InputBox("Ingrese el valor del Tirante Normal (Yn) Nota: El valor debe ser
mayor a 0", "Valor de la tirante normal", , 10000, 5000))

r = d / 2
h = Abs(r - yn)
Pi = 4 * Atn(1)
x = h / r

'Calculo de angulos
alfa = 2 * (Atn(-x / Sqr(-x * x + 1)) + 2 * Atn(1))
alfa1 = (alfa * 180) / (Pi)
beta = 2 * Pi - alfa
beta1 = (beta * 180) / (Pi)

If y > r Then
a = (beta - Sin(beta)) * (d ^ 2 / 8)
p = beta * d / 2
rh = a / p
ef = a * ((rh) ^ (2 / 3))
Else
a = (alfa - Sin(alfa)) * (d ^ 2 / 8)
p = alfa * d / 2
rh = a / p
eg = ((rh) ^ (2 / 3)) * a
End If
ListBox1.AddItem FormatNumber(yn, 4)
ListBox2.AddItem FormatNumber(eg, 4)

If (FormatNumber(eh, 4) = FormatNumber(eg, 4)) Then


resultado = MsgBox("El valor de Yn es =" & yn & vbNewLine & "Con un
resultado de =" & eh, vbOKCancel)
If (resultado = vbOK) Or (resultado = vbCancel) Then
Range("B13").Select
ActiveCell.FormulaR1C1 = "Tirante Normal"
Range("C13").Select
ActiveCell.FormulaR1C1 = FormatNumber(yn, 3)
Vn = (1 / n) * (((b * yn) / (b + 2 * yn)) ^ (2 / 3)) * (S ^ (1 / 2))
Range("B14").Select
ActiveCell.FormulaR1C1 = "Velocidad Normal = "
Range("C14").Select
ActiveCell.FormulaR1C1 = FormatNumber(Vn, 3)
End
End If
Else
If (FormatNumber(eh, 4) > FormatNumber(eg, 4)) Then
MsgBox ("Ingrese un valor mayor de Yn")
Else
MsgBox ("Ingrese un valor menor de Yn")
End If
End If
Loop Until (FormatNumber(eh, 4) = FormatNumber(eg, 4))

End Sub

Private Sub CommandButton5_Click()


circular_calcular
End Sub

Sub parabola_calcular()
ListBox1.Visible = True
ListBox2.Visible = True
ListBox1.Clear
ListBox2.Clear
Range("B6").Select
ActiveCell.FormulaR1C1 = " "
Range("B7").Select
ActiveCell.FormulaR1C1 = " "
Range("B8").Select
ActiveCell.FormulaR1C1 = " "
Range("B9").Select
ActiveCell.FormulaR1C1 = " "
Range("C6").Select
ActiveCell.FormulaR1C1 = " "
Range("C7").Select
ActiveCell.FormulaR1C1 = " "
Range("C8").Select
ActiveCell.FormulaR1C1 = " "
Range("C9").Select
ActiveCell.FormulaR1C1 = " "
Range("B15").Select
ActiveCell.FormulaR1C1 = " "
Range("C15").Select
ActiveCell.FormulaR1C1 = " "
Range("B13").Select
ActiveCell.FormulaR1C1 = " "
Range("C13").Select
ActiveCell.FormulaR1C1 = " "
Range("B14").Select
ActiveCell.FormulaR1C1 = " "
Range("C14").Select
ActiveCell.FormulaR1C1 = " "
Range("B10").Select
ActiveCell.FormulaR1C1 = " "
Range("C10").Select
ActiveCell.FormulaR1C1 = " "
Range("B11").Select
ActiveCell.FormulaR1C1 = " "
Range("C11").Select
ActiveCell.FormulaR1C1 = " "
Range("B12").Select
ActiveCell.FormulaR1C1 = " "
Range("C12").Select
ActiveCell.FormulaR1C1 = " "
Do
Q = Val(InputBox("Ingrese el valor del caudal (Q) teniendo en cuenta que tiene que
ser mayor que 0"))
S = Val(InputBox("Ingrese el valor de la pendiente(S) teniendo en cuenta que tiene
que ser mayor que 0"))
n = Val(InputBox("Ingrese el valor del coeficiente de rugosidad(n) teniendo en
cuenta que tiene que ser mayor que 0"))
Loop Until (Q > 0) And (S > 0) And (n > 0)

Range("B6").Select
ActiveCell.FormulaR1C1 = "Caudal = "
Range("B7").Select
ActiveCell.FormulaR1C1 = "Pendiente = "
Range("B8").Select
ActiveCell.FormulaR1C1 = "Coeficiente de rugosidad de Manning = "
Range("C6").Select
ActiveCell.FormulaR1C1 = Q
Range("C7").Select
ActiveCell.FormulaR1C1 = S
Range("C8").Select
ActiveCell.FormulaR1C1 = n

eh = (Q * n) / (S ^ (1 / 2))

Range("B15").Select
ActiveCell.FormulaR1C1 = "Elemento hidr�ulico = "
Range("C15").Select
ActiveCell.FormulaR1C1 = FormatNumber(eh, 4)

Do

yn = Val(InputBox("Ingrese el valor del Tirante Normal (Yn) Nota: El valor debe ser
mayor a 0", "Valor de la tirante normal", , 10000, 5000))
t = 2 * Sqr(yn)
a = 2 / 3 * t * yn
x = 4 * yn / t

If (x > 0 And x <= 1) Then

p = t + ((8 * yn ^ 2) / (3 * t))
Else
p = (t / 2) * (Sqr(1 + x ^ 2) + (1 / x) * (Log(x + Sqr(1 + x ^ 2))))

End If

rh = a / p
eg = ((rh) ^ (2 / 3)) * a
Range("H11").Select
ListBox1.AddItem FormatNumber(yn, 4)
ListBox2.AddItem FormatNumber(eg, 4)
If (FormatNumber(eh, 4) = FormatNumber(eg, 4)) Then
resultado = MsgBox("El valor de Yn es =" & yn & vbNewLine & "Con un
resultado de =" & eh, vbOKCancel)
If (resultado = vbOK) Or (resultado = vbCancel) Then
Range("B13").Select
ActiveCell.FormulaR1C1 = "Tirante Normal"
Range("C13").Select
ActiveCell.FormulaR1C1 = FormatNumber(yn, 3)
Vn = (1 / n) * (((rh) ^ (2 / 3)) * (S ^ (1 / 2)))
Range("B14").Select
ActiveCell.FormulaR1C1 = "Velocidad Normal = "
Range("C14").Select
ActiveCell.FormulaR1C1 = FormatNumber(Vn, 3)
End
End If
Else
If (FormatNumber(eh, 4) > FormatNumber(eg, 4)) Then
MsgBox ("Ingrese un valor mayor de Yn")
Else
MsgBox ("Ingrese un valor menor de Yn")
End If
End If
Loop Until (FormatNumber(eh, 4) = FormatNumber(eg, 4))

End Sub

Private Sub CommandButton6_Click()


parabola_calcular
End Sub
Sub rectanguloredondeado()
ListBox1.Visible = True
ListBox2.Visible = True
ListBox1.Clear
ListBox2.Clear
Range("B6").Select
ActiveCell.FormulaR1C1 = " "
Range("B7").Select
ActiveCell.FormulaR1C1 = " "
Range("B8").Select
ActiveCell.FormulaR1C1 = " "
Range("B9").Select
ActiveCell.FormulaR1C1 = " "
Range("C6").Select
ActiveCell.FormulaR1C1 = " "
Range("C7").Select
ActiveCell.FormulaR1C1 = " "
Range("C8").Select
ActiveCell.FormulaR1C1 = " "
Range("C9").Select
ActiveCell.FormulaR1C1 = " "
Range("B15").Select
ActiveCell.FormulaR1C1 = " "
Range("C15").Select
ActiveCell.FormulaR1C1 = " "
Range("B13").Select
ActiveCell.FormulaR1C1 = " "
Range("C13").Select
ActiveCell.FormulaR1C1 = " "
Range("B14").Select
ActiveCell.FormulaR1C1 = " "
Range("C14").Select
ActiveCell.FormulaR1C1 = " "
Range("B10").Select
ActiveCell.FormulaR1C1 = " "
Range("C10").Select
ActiveCell.FormulaR1C1 = " "
Range("B11").Select
ActiveCell.FormulaR1C1 = " "
Range("C11").Select
ActiveCell.FormulaR1C1 = " "
Range("B12").Select
ActiveCell.FormulaR1C1 = " "
Range("C12").Select
ActiveCell.FormulaR1C1 = " "
Do
Q = Val(InputBox("Ingrese el valor del caudal (Q) teniendo en cuenta que tiene que
ser mayor que 0"))
S = Val(InputBox("Ingrese el valor de la pendiente(S) teniendo en cuenta que tiene
que ser mayor que 0"))
n = Val(InputBox("Ingrese el valor del coeficiente de rugosidad(n) teniendo en
cuenta que tiene que ser mayor que 0"))
b = Val(InputBox("Ingrese el valor de la base (b) teniendo en cuenta que tiene que
ser mayor que 0"))

Loop Until (Q > 0) And (S > 0) And (n > 0) And (b > 0)

Range("B6").Select
ActiveCell.FormulaR1C1 = "Caudal = "
Range("B7").Select
ActiveCell.FormulaR1C1 = "Pendiente = "
Range("B8").Select
ActiveCell.FormulaR1C1 = "Coeficiente de rugosidad de Manning = "
Range("B9").Select
ActiveCell.FormulaR1C1 = "Base = "
Range("C9").Select
ActiveCell.FormulaR1C1 = b
Range("C6").Select
ActiveCell.FormulaR1C1 = Q
Range("C7").Select
ActiveCell.FormulaR1C1 = S
Range("C8").Select
ActiveCell.FormulaR1C1 = n

eh = (Q * n) / (S ^ (1 / 2))

Range("B15").Select
ActiveCell.FormulaR1C1 = "Elemento hidr�ulico = "
Range("C15").Select
ActiveCell.FormulaR1C1 = FormatNumber(eh, 4)

Do

yn = Val(InputBox("Ingrese el valor del Tirante Normal (Yn) Nota: El valor debe ser
mayor a 0", "Valor de la tirante normal", , 10000, 5000))
r = Val(InputBox("Ingrese el valor del radio (r) Nota: El valor debe ser mayor a
0", "Valor de la tirante normal", , 10000, 5000))

Pi = 4 * Atn(1)
a = (Pi / 2 - 2) * r ^ 2 + (b + 2 * r) * yn
p = (Pi - 2) * r + b + 2 * yn
rh = a / p
eg = ((rh) ^ (2 / 3)) * a
Range("H11").Select
ListBox1.AddItem FormatNumber(yn, 4)
ListBox2.AddItem FormatNumber(eg, 4)
If (FormatNumber(eh, 4) = FormatNumber(eg, 4)) Then
resultado = MsgBox("El valor de Yn es =" & yn & vbNewLine & "Con un
resultado de =" & eh, vbOKCancel)
If (resultado = vbOK) Or (resultado = vbCancel) Then
Range("B13").Select
ActiveCell.FormulaR1C1 = "Tirante Normal"
Range("C13").Select
ActiveCell.FormulaR1C1 = FormatNumber(yn, 3)
Vn = (1 / n) * (((rh) ^ (2 / 3)) * (S ^ (1 / 2)))
Range("B14").Select
ActiveCell.FormulaR1C1 = "Velocidad Normal = "
Range("C14").Select
ActiveCell.FormulaR1C1 = FormatNumber(Vn, 3)
End
End If
Else
If (FormatNumber(eh, 4) > FormatNumber(eg, 4)) Then
MsgBox ("Ingrese un valor mayor de Yn")
Else
MsgBox ("Ingrese un valor menor de Yn")
End If
End If
Loop Until (FormatNumber(eh, 4) = FormatNumber(eg, 4)) And (y > r) And (y > 0) And
(r > 0)

End Sub

Private Sub CommandButton7_Click()


rectanguloredondeado
End Sub
Sub trianguloredondeado()
ListBox1.Visible = True
ListBox2.Visible = True
ListBox1.Clear
ListBox2.Clear
Range("B6").Select
ActiveCell.FormulaR1C1 = " "
Range("B7").Select
ActiveCell.FormulaR1C1 = " "
Range("B8").Select
ActiveCell.FormulaR1C1 = " "
Range("B9").Select
ActiveCell.FormulaR1C1 = " "
Range("C6").Select
ActiveCell.FormulaR1C1 = " "
Range("C7").Select
ActiveCell.FormulaR1C1 = " "
Range("C8").Select
ActiveCell.FormulaR1C1 = " "
Range("C9").Select
ActiveCell.FormulaR1C1 = " "
Range("B15").Select
ActiveCell.FormulaR1C1 = " "
Range("C15").Select
ActiveCell.FormulaR1C1 = " "
Range("B13").Select
ActiveCell.FormulaR1C1 = " "
Range("C13").Select
ActiveCell.FormulaR1C1 = " "
Range("B14").Select
ActiveCell.FormulaR1C1 = " "
Range("C14").Select
ActiveCell.FormulaR1C1 = " "
Range("B10").Select
ActiveCell.FormulaR1C1 = " "
Range("C10").Select
ActiveCell.FormulaR1C1 = " "
Range("B11").Select
ActiveCell.FormulaR1C1 = " "
Range("C11").Select
ActiveCell.FormulaR1C1 = " "
Range("B12").Select
ActiveCell.FormulaR1C1 = " "
Range("C12").Select
ActiveCell.FormulaR1C1 = " "
Do
Q = Val(InputBox("Ingrese el valor del caudal (Q) teniendo en cuenta que tiene que
ser mayor que 0"))
S = Val(InputBox("Ingrese el valor de la pendiente(S) teniendo en cuenta que tiene
que ser mayor que 0"))
n = Val(InputBox("Ingrese el valor del coeficiente de rugosidad(n) teniendo en
cuenta que tiene que ser mayor que 0"))
Z = Val(InputBox("Ingrese el valor del talud (z) teniendo en cuenta que tiene que
ser mayor que 0"))
r = Val(InputBox("Ingrese el valor del radio (r) Nota: El valor debe ser mayor a
0", "Valor de la tirante normal", , 10000, 5000))
Loop Until (Q > 0) And (S > 0) And (n > 0) And (Z > 0) And (r > 0)

Range("B6").Select
ActiveCell.FormulaR1C1 = "Caudal = "
Range("B7").Select
ActiveCell.FormulaR1C1 = "Pendiente = "
Range("B8").Select
ActiveCell.FormulaR1C1 = "Coeficiente de rugosidad de Manning = "
Range("B9").Select
ActiveCell.FormulaR1C1 = "Talud = "
Range("B10").Select
ActiveCell.FormulaR1C1 = "Radio = "
Range("C10").Select
ActiveCell.FormulaR1C1 = r
Range("C9").Select
ActiveCell.FormulaR1C1 = Z
Range("C6").Select
ActiveCell.FormulaR1C1 = Q
Range("C7").Select
ActiveCell.FormulaR1C1 = S
Range("C8").Select
ActiveCell.FormulaR1C1 = n

eh = (Q * n) / (S ^ (1 / 2))

Range("B15").Select
ActiveCell.FormulaR1C1 = "Elemento hidr�ulico = "
Range("C15").Select
ActiveCell.FormulaR1C1 = FormatNumber(eh, 4)

Do

yn = Val(InputBox("Ingrese el valor del Tirante Normal (Yn) Nota: El valor debe ser
mayor a 0", "Valor de la tirante normal", , 10000, 5000))

Pi = 4 * Atn(1)

ang = 1 / Z
fi = Atn(ang)
ti = Pi - 2 * fi
b = Pi - ti

x = 2 * r * Sin(b / 2)
h = r * Cos(b / 2)
y1 = r - h
e = yn - y1
m1 = 2 * (e / Tan(fi))
t = x + m1

a = ((t ^ 2) / (4 * Z)) - ((r ^ 2) / Z) * (1 - Z * fi)


p = t / Z * Sqr(1 + Z ^ 2) - 2 * r / Z * (1 - Z * fi)
rh = a / p
eg = ((rh) ^ (2 / 3)) * a
Range("H11").Select
ListBox1.AddItem FormatNumber(yn, 4)
ListBox2.AddItem FormatNumber(eg, 4)
If (FormatNumber(eh, 4) = FormatNumber(eg, 4)) Then
resultado = MsgBox("El valor de Yn es =" & yn & vbNewLine & "Con un
resultado de =" & eh, vbOKCancel)
If (resultado = vbOK) Or (resultado = vbCancel) Then
Range("B13").Select
ActiveCell.FormulaR1C1 = "Tirante Normal"
Range("C13").Select
ActiveCell.FormulaR1C1 = FormatNumber(yn, 3)
Vn = (1 / n) * (((rh) ^ (2 / 3)) * (S ^ (1 / 2)))
Range("B14").Select
ActiveCell.FormulaR1C1 = "Velocidad Normal = "
Range("C14").Select
ActiveCell.FormulaR1C1 = FormatNumber(Vn, 3)
End
End If
Else
If (FormatNumber(eh, 4) > FormatNumber(eg, 4)) Then
MsgBox ("Ingrese un valor mayor de Yn")
Else
MsgBox ("Ingrese un valor menor de Yn")
End If
End If
Loop Until (FormatNumber(eh, 4) = FormatNumber(eg, 4)) And (y > r) And (y > 0)

End Sub

Private Sub CommandButton8_Click()


trianguloredondeado
End Sub

Você também pode gostar