1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| Private Sub L_Apporteur_Change()
deb = Right(Year(Now), 2)
'T_dossier = ""
'On Error GoTo fin:
If C_Prospect = faux Then
If L_Apporteur = "JO" Then
num = 2000
For i = 1 To 10000
If Left(Cells(i, 3), 1) = 2 Then If Cells(i, 3) > num Then num = Cells(i, 3)
Next i
T_dossier = num + 1
Exit Sub
End If
If L_Apporteur = "paris" Then
num = 75000
For i = 1 To 10000
If Left(Cells(i, 3), 1) = 2 Then If Cells(i, 3) > num Then num = Cells(i, 3)
Next i
T_dossier = num + 1
Exit Sub
End If
If L_Apporteur <> "" Then
num = (deb & WorksheetFunction.VLookup(L_Apporteur, Sheets("PAram").Range("B2:C50"), 2, faux)) - 1
For i = 1 To 10000
If i = 605 Then
' MsgBox ("ok")
End If
If Left(Cells(i, 3), 3) = deb & Left(WorksheetFunction.VLookup(L_Apporteur, Sheets("PAram").Range("B2:C50"), 2, faux), 1) And Len(Cells(i, 3)) = 5 And Cells(i, 3).Text < (deb & ((WorksheetFunction.VLookup(L_Apporteur, Sheets("PAram").Range("B2:C50"), 2, faux)) + 49)) Then If Cells(i, 3) > num Then num = Cells(i, 3)
Next i
T_dossier = num + 1
Exit Sub
End If
End If
'fin:
'T_dossier = ""
End Sub |
Partager