Leandroarb
Board Regular
- Joined
- Oct 7, 2014
- Messages
- 157
Hi,
The logical for this code are correct?
I need it to repeat the loop until the value of cont is equal to
The logical for this code are correct?
I need it to repeat the loop until the value of cont is equal to
Code:
Int(Left(Prazo, 2))
Code:
Global rng As Range
Global dtData As Range
Global crit As Variant
Public Function PrazoFinal(DatasAbono As Range, vlrData As Variant) ', Prazo As String, Data_Protocolo As Date) 'DatasAbono = Intervalo com datas não contáveis
Dim cont As Integer 'Prazo = Célula com o prazo do serviço
Dim j As Integer 'Data_Protocolo = Célula com data e hora do protocol
Dim strVerif As String
Set rng = DatasAbono
cont = 0
j = 0
Do Until cont = Int(Left(Prazo, 2))
j = j + 1
vlrData = Format(DateAdd("d", j, Data_Protocolo), "dd/mm/yyyy")
crit = vlrData
If Verif = "UT" Then
PrazoFinal = crit
cont = cont + 1
End If
Loop
End Function
Public Function Verif() As String '(rng As Range, crit As Variant) As String
Dim rng2 As Range
Dim cel As Range
Set rng2 = rng
Dim strVerif As String
For Each cel In rng2
If cel = crit Then
strVerif = crit
End If
Next cel
If strVerif <> "" Then Verif = "UT" Else Verif = "IN"
End Function