AW: Zeiten in Textbox
28.08.2006 19:49:17
Rene
Hallo!
Kleine Rückmeldung. Habe es doch noch geschafft. Habe die Formel von Franz (fcs) ein klein wenig umgestellt, und nach langem probieren doch noch gangbar gemacht.
Code:
Private Sub CommandButton31_Click()
On Error Resume Next
Dim i1Zeit As Integer
Dim i2Zeit As Integer
Dim i3Zeit As Integer
Dim i4Zeit As Integer
Dim i5Zeit As Integer
Dim i1Posit As Integer
Dim i2Posit As Integer
Dim i3Posit As Integer
Dim i4Posit As Integer
Dim i5Posit As Integer
Dim i As Integer
i1Posit = InStr(TextBox1.Value, ":")
i2Posit = InStr(TextBox2.Value, ":")
i3Posit = InStr(TextBox3.Value, ":")
i4Posit = InStr(TextBox4.Value, ":")
i5Posit = InStr(TextBox5.Value, ":")
i1Zeit = CInt(Left(TextBox1.Value, i1Posit - 1) * 60) + _
CInt(Right(TextBox1.Value, Len(TextBox1.Value) - i1Posit))
i2Zeit = CInt(Left(TextBox2.Value, i2Posit - 1) * 60) + _
CInt(Right(TextBox2.Value, Len(TextBox2.Value) - i2Posit))
i3Zeit = CInt(Left(TextBox3.Value, i3Posit - 1) * 60) + _
CInt(Right(TextBox3.Value, Len(TextBox3.Value) - i3Posit))
i4Zeit = CInt(Left(TextBox4.Value, i4Posit - 1) * 60) + _
CInt(Right(TextBox4.Value, Len(TextBox4.Value) - i4Posit))
i5Zeit = CInt(Left(TextBox5.Value, i5Posit - 1) * 60) + _
CInt(Right(TextBox5.Value, Len(TextBox5.Value) - i5Posit))
TextBox6.Value = Format(Int((i1Zeit + i2Zeit + i3Zeit + i4Zeit + i5Zeit) / 60) + ((i1Zeit + i2Zeit + i3Zeit + i4Zeit + i5Zeit) / 60 - _
Int((i1Zeit + i2Zeit + i3Zeit + i4Zeit + i5Zeit) / 60)) * 60 / 100, "#0.00")
TextBox6.Value = Replace(TextBox6.Value, ",", ":")
End Sub
Gruss Rene