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
| Private Sub UserForm_Initialize()
'creation liste combobox massif
With Sheets("Liste")
Dim x As Integer, plage As Range, nl As Integer, d As Integer
nl = .Range("A" & .Rows.Count).End(xlUp).Row
'Boucle sur les cellules de la plage A2:A1870 pour
'alimenter le ComboBox
ParMassif.Clear
For x = 2 To nl
Set plage = .Range("a" & x + 1, "a" & nl + 1)
'remplissage sans doublon
d = Application.WorksheetFunction.CountIf(plage, .Range("a" & x))
If d = 0 Then
ParMassif.AddItem .Range("a" & x)
End If
Next x
End With
'creation liste combobox matricule
With Sheets("Liste")
Dim y As Integer, plage1 As Range, nli As Integer, c As Integer
nli = .Range("c" & .Rows.Count).End(xlUp).Row
'Boucle sur les cellules de la plage c2:c1870 pour
'alimenter le ComboBox
ParCode.Clear
For x = 2 To nli
Set plage1 = .Range("c" & x + 1, "c" & nl + 1)
'remplissage sans doublon
c = Application.WorksheetFunction.CountIf(plage, .Range("c" & x))
If c = 0 Then
ParCode.AddItem .Range("c" & x)
End If
Next x
End With
'creation liste combobox Par nom
With Sheets("Liste")
Dim z As Integer, plage2 As Range, nlig As Integer, e As Integer
nlig = .Range("d" & .Rows.Count).End(xlUp).Row
'Boucle sur les cellules de la plage d2:d1870 pour
'alimenter le ComboBox
ParNom.Clear
For z = 2 To nl
Set plage = .Range("d" & z + 1, "d" & nl + 1)
'remplissage sans doublon
e = Application.WorksheetFunction.CountIf(plage, .Range("d" & z))
If d = 0 Then
ParNom.AddItem .Range("d" & z)
End If
Next z
End With
End Sub |
Partager