Function tt(Mystr As String, Optional Dautp As String) As Double
Dim i As Integer
Dim s As String
i = InStr(1, Mystr, ":")
s = Right(Mystr, Len(Mystr) - i)
tt = Evaluate("=" & s)
End Function
Function dt(Mystr As String, Optional Dautp As String) As Double
Dim i As Integer
Dim s As String
i = InStr(1, Mystr, ":")
dt = Evaluate("=" & i)
End Function
Function theptohop(Mystr As String, Optional Dautp As String) As Double
Dim z1, z2 As Integer
z1 = InStr(1, Mystr, "x")
z2 = InStr(1, Mystr, "~")
If z1 = 10 Then
Dim a, b, c, d, e, f As String
Dim x1, x2, x3, x4, x5, x6, x7, x8 As Integer
Dim bb, bc, tong As Double
x1 = InStr(1, Mystr, ":")
x2 = InStr(1, Mystr, "x")
x3 = InStr(1, Mystr, "-")
x4 = InStr(1, Mystr, ",")
x5 = InStr(1, Mystr, "L")
x6 = InStr(1, Mystr, ".")
x7 = InStr(1, Mystr, "[")
x8 = InStr(1, Mystr, "]")
a = Mid(Mystr, x1 + 2, x2 - x1 - 2)
b = Mid(Mystr, x2 + 1, 3)
c = Mid(Mystr, x2 + 5, x3 - x2 - 5)
d = Mid(Mystr, x3 + 1, x4 - x3 - 1)
e = Mid(Mystr, x5 + 2, x6 - x5 - 2)
f = Mid(Mystr, x7 + 4, x8 - x7 - 4)
bb = Evaluate("=" & a * c * e * 10 ^ (-9) * 7850 * f)
bc = Evaluate("=" & b * d * e * 10 ^ (-9) * 7850 * 2 * f)
tong = bb + bc
theptohop = tong
Else
If z2 = 11 Then
Dim a1, a2, b1, c1, d1, e1, f1 As String
Dim y1, y2, y3, y4, y5, y6, y7, y8, y9 As Integer
Dim atb, bb1, bc1, tong1 As Double
y1 = InStr(1, Mystr, "(")
y2 = InStr(1, Mystr, "~")
y3 = InStr(1, Mystr, ")")
y4 = InStr(1, Mystr, "-")
y5 = InStr(1, Mystr, ",")
y6 = InStr(1, Mystr, "L")
y7 = InStr(1, Mystr, ".")
y8 = InStr(1, Mystr, "[")
y9 = InStr(1, Mystr, "]")
a1 = Mid(Mystr, y1 + 1, y2 - y1 - 1)
a2 = Mid(Mystr, y2 + 1, y3 - y2 - 1)
b1 = Mid(Mystr, y3 + 2, 3)
c1 = Mid(Mystr, y3 + 6, y4 - y3 - 6)
d1 = Mid(Mystr, y4 + 1, y5 - y4 - 1)
e1 = Mid(Mystr, y6 + 2, y7 - y6 - 2)
f1 = Mid(Mystr, y8 + 4, y9 - y8 - 4)
atb = Evaluate("=" & a1 / 2 + a2 / 2)
bb1 = Evaluate("=" & atb * c1 * e1 * 10 ^ (-9) * 7850 * f1)
bc1 = Evaluate("=" & b1 * d1 * e1 * 10 ^ (-9) * 7850 * 2 * f1)
tong1 = bb1 + bc1
theptohop = tong1
Else
theptohop = "kiem tra lai text"
End If
End If
End FunctionFunction sontheptohop(Mystr As String, Optional Dautp As String) As Double
Dim z1, z2 As Integer
z1 = InStr(1, Mystr, "x")
z2 = InStr(1, Mystr, "~")
If z1 = 10 Then
Dim a, b, c, d, e, f As String
Dim x1, x2, x3, x4, x5, x6, x7, x8 As Integer
Dim bb, bc, tong As Double
x1 = InStr(1, Mystr, ":")
x2 = InStr(1, Mystr, "x")
x3 = InStr(1, Mystr, "-")
x4 = InStr(1, Mystr, ",")
x5 = InStr(1, Mystr, "L")
x6 = InStr(1, Mystr, ".")
x7 = InStr(1, Mystr, "[")
x8 = InStr(1, Mystr, "]")
a = Mid(Mystr, x1 + 2, x2 - x1 - 2)
b = Mid(Mystr, x2 + 1, 3)
c = Mid(Mystr, x2 + 5, x3 - x2 - 5)
d = Mid(Mystr, x3 + 1, x4 - x3 - 1)
e = Mid(Mystr, x5 + 2, x6 - x5 - 2)
f = Mid(Mystr, x7 + 4, x8 - x7 - 4)
bb = Evaluate("=" & a * e * 10 ^ (-6) * f * 2)
bc = Evaluate("=" & b * e * 10 ^ (-6) * 2 * f * 2)
tong = bb + bc
sontheptohop = tong
Else
If z2 = 11 Then
Dim a1, a2, b1, c1, d1, e1, f1 As String
Dim y1, y2, y3, y4, y5, y6, y7, y8, y9 As Integer
Dim atb, bb1, bc1, tong1 As Double
y1 = InStr(1, Mystr, "(")
y2 = InStr(1, Mystr, "~")
y3 = InStr(1, Mystr, ")")
y4 = InStr(1, Mystr, "-")
y5 = InStr(1, Mystr, ",")
y6 = InStr(1, Mystr, "L")
y7 = InStr(1, Mystr, ".")
y8 = InStr(1, Mystr, "[")
y9 = InStr(1, Mystr, "]")
a1 = Mid(Mystr, y1 + 1, y2 - y1 - 1)
a2 = Mid(Mystr, y2 + 1, y3 - y2 - 1)
b1 = Mid(Mystr, y3 + 2, 3)
c1 = Mid(Mystr, y3 + 6, y4 - y3 - 6)
d1 = Mid(Mystr, y4 + 1, y5 - y4 - 1)
e1 = Mid(Mystr, y6 + 2, y7 - y6 - 2)
f1 = Mid(Mystr, y8 + 4, y9 - y8 - 4)
atb = Evaluate("=" & a1 / 2 + a2 / 2)
bb1 = Evaluate("=" & atb * e1 * 10 ^ (-6) * f1 * 2)
bc1 = Evaluate("=" & b1 * e1 * 10 ^ (-6) * 2 * f1 * 2)
tong1 = bb1 + bc1
sontheptohop = tong1
Else
sontheptohop = "kiem tra lai text"
End If
End If
End Function
|