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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
Public nom As String
Public prenom As String
Public mail As String
Public Sub nom()
Dim valeur As String
Dim LigneInd As Integer
Dim LigneNew As Integer
Dim URF As String
Dim statut As String
Dim nomt As String
Dim prenomt As String
Dim mailt As String
Dim UFRt As String
Dim statutT As String
Dim concat As String
Dim idt As String
Dim a As Integer
Dim plage As Variant
LigneNew = 2
'récupération des nouvelles itérations
While Worksheets("Nouveau").Cells(LigneNew, 3).Value <> ""
nom = Worksheets("Nouveau").Cells(LigneNew, 3).Value
prenom = Worksheets("Nouveau").Cells(LigneNew, 4).Value
mail = Worksheets("Nouveau").Cells(LigneNew, 5).Value
'nettoyage des noms
nom = MajSansAccent(nom)
prenom = MajSansAccent(prenom)
mail = LCase(mail)
LigneInd = 2
'Pour retrouver les individus
While Worksheets("Individu").Cells(LigneInd, 1).Value <> ""
'on récupère les infos d'une ligne dans la bdd Individu
nomt = Worksheets("Individu").Cells(LigneInd, 1).Value
prenomt = Worksheets("Individu").Cells(LigneInd, 2).Value
mailt = LCase(Worksheets("Individu").Cells(LigneInd, 3).Value)
UFRt = LCase(Worksheets("Individu").Cells(LigneInd, 4).Value)
statutT = LCase(Worksheets("Individu").Cells(LigneInd, 5).Value)
concat = LCase(Worksheets("Individu").Cells(LigneInd, 6).Value)
idt = LCase(Worksheets("Individu").Cells(LigneInd, 7).Value)
'test de correspondance
If ((InStr(1, nom, nomt) <> 0 Or InStr(1, nomt, nom) <> 0) And (nom <> "" And nomt <> "")) Or ((InStr(1, prenom, prenomt) <> 0 Or InStr(1, prenomt, prenom) <> 0) And (prenom <> "" And prenomt <> "")) Or ((InStr(1, mail, mailt) <> 0 Or InStr(1, mailt, mail) <> 0) And (mail <> "" And mailt <> "")) Then
a = 1
While Worksheets("Temp").Cells(a, 1).Value <> ""
a = a + 1
Wend
'stockage des données pour liste déroulante
Worksheets("Temp").Cells(a, 1).Value = idt
Worksheets("Temp").Cells(a, 2).Value = nomt
Worksheets("Temp").Cells(a, 3).Value = prenomt
Worksheets("Temp").Cells(a, 5).Value = mailt
Worksheets("Temp").Cells(a, 4).Value = concat
Worksheets("Individu").Cells(LigneInd, 8).Value = "x"
End If
LigneInd = LigneInd + 1
Wend
UserForm.Show
LigneNew = LigneNew + 1
Sheets("Temp").Cells.Clear
Worksheets("Individu").Cells(1, 8).EntireColumn.Delete
Wend
End Sub
Function MajSansAccent(test As String) As String
Dim VAccent As String
Dim VSsAccent As String
VAccent = "àáâãäåéêëèìíîïðòóôõöùúûüç-.,?"
VSsAccent = "aaaaaaeeeeiiiioooooouuuuc "
Dim Bcle As Integer
For Bcle = 1 To Len(VAccent)
test = Replace(test, Mid(VAccent, Bcle, 1), Mid(VSsAccent, Bcle, 1))
Next Bcle
test = Replace(test, " ", "")
MajSansAccent = UCase(test)
End Function |
Partager