22/Ago/05 13:40
Re: Pregunta para ByPaco
Lo que pasa es que esta protegida, lo lamento.
Copia este código:
[code:1:e044bfdc16]Function DIALAB(FechaInicial As Date, NroDias As Integer, Optional IncluyeSab As Integer = 0, Optional Feriados) As Date
Dim i, Aux As Date, Cont, x As Integer
Aux = FechaInicial + 1
If IncluyeSab = 0 Then
FechaInicial = FechaInicial + NroDias
For i = Aux To FechaInicial
If Weekday(i, 1) = 1 Or Weekday(i, 1) = 7 Then Cont = Cont + 1
Next
FechaInicial = FechaInicial + Cont
Cont = 0
For i = Aux To FechaInicial
If Weekday(i, 1) > 1 And Weekday(i, 1) < 7 Then Cont = Cont + 1
Next
If Cont <> NroDias Then FechaInicial = FechaInicial + Abs(NroDias - Cont)
Else
FechaInicial = FechaInicial + NroDias
For i = Aux To FechaInicial
If Weekday(i, 1) = 1 Then Cont = Cont + 1
Next
FechaInicial = FechaInicial + Cont
Cont = 0
For i = Aux To FechaInicial
If Weekday(i, 1) <> 1 Then Cont = Cont + 1
Next
If Cont <> NroDias Then FechaInicial = FechaInicial + Abs(NroDias - Cont)
End If
If IncluyeSab = 0 And Not IsMissing(Feriados) Then
Cont = 0
Aux = Aux '- 1
For x = 1 To Feriados.Count
If Feriados(x) >= Aux And Feriados(x) <= FechaInicial Then
If Weekday(Feriados(x), 1) > 1 And Weekday(Feriados(x), 1) < 7 Then Cont = Cont + 1
End If
Next
FechaInicial = FechaInicial + Cont
Else
If IncluyeSab <> 0 And Not IsMissing(Feriados) Then
Cont = 0
Aux = Aux - 1
For x = 1 To Feriados.Count
If Feriados(x) >= Aux And Feriados(x) <= FechaInicial Then
If Weekday(Feriados(x), 1) <> 1 Then Cont = Cont + 1
End If
Next
FechaInicial = FechaInicial + Cont
End If
End If
If Weekday(FechaInicial, 1) = 1 Then FechaInicial = FechaInicial + 1
If IncluyeSab = 0 Then
If Weekday(FechaInicial, 1) = 7 Then FechaInicial = FechaInicial + 2
End If
DIALAB = FechaInicial
End Function[/code:1:e044bfdc16]
«Antes que cambien los reinos, los hombres deberán cambiar»
═╬═