
18/12/2006, 08:02
|
| | Fecha de Ingreso: agosto-2006 Ubicación: en lima peru
Mensajes: 184
Antigüedad: 18 años, 5 meses Puntos: 0 | |
ya encontre la solución aquí lo coloco si por alguien quiere la solución
Private Function sumaHoras(H1 As String, H2 As String) As String
Dim vh1 As Variant
Dim vh2 As Variant
Dim intContador As Integer
Dim vh3(2) As Long
Dim H3 As String
'Convertir a arrays
vh1 = Split(H1, ":")
vh2 = Split(H2, ":")
'Contemplar tambien los segundos
For intContador = 0 To 2
'Sumar las horas, minutos, segundos
If intContador <= UBound(vh1) Then vh3(intContador) = Val(vh1(intContador))
If intContador <= UBound(vh2) Then vh3(intContador) = vh3(intContador) + Val(vh2(intContador))
Next intContador
'Descontar las cantidades mayores de 60 en 1 y 2
vh3(1) = vh3(1) + vh3(2) \ 60
vh3(2) = vh3(2) Mod 60
vh3(0) = vh3(0) + vh3(1) \ 60
vh3(1) = vh3(1) Mod 60
'Constuir la cadena a devolver
sumaHoras = Format(vh3(0), "00") & ":" & Format(vh3(1), "00") & ":" & Format(vh3(2), "00")
End Function |