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
| Sub listeV2()
Dim DerLigne As Long, k As Long, i As Long, j As Long
Dim MaSoc As String
Range("K14:IV18").Clear 'Efface les données précédentes
DerLigne = Sheets("BDD").Cells(Columns(1).Cells.Count, 1).End(xlUp).Row 'Defini la dernière ligne de la base
MaSoc = Sheets("Consultation").Range("F5") 'Défini la société selon le nom
For i = 2 To DerLigne 'Boucle pour vérifier la société
If Sheets("BDD").Cells(i, 1).Value = MaSoc Then 'Si société =
For j = 14 To 18 'Boucle sur les services
k = Cells(j, Rows(j).Cells.Count).End(xlToLeft).Column 'Defini la dernière colonne remplie
If Sheets("Bdd").Cells(i, 3) = Sheets("Consultation").Cells(j, 10) Then 'Vérifie si service =
Sheets("Consultation").Cells(j, k + 1) = Sheets("BDD").Cells(i, 4) 'si oui applique le nom
Sheets("Consultation").Cells(j, k + 2) = Sheets("BDD").Cells(i, 5) 'si oui applique le statut réunion Oui/non
End If
Next j
End If
Next i
For i = 14 To 18 'Boucle pour mettre Pas de contact
If Sheets("Consultation").Cells(i, 10) = "" Then Sheets("Consultation").Cells(i, 10) = "Pas de contact"
Next i
End Sub |
Partager