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
| Private Sub UserForm_Initialize()
Dim i As Integer
Dim nom As String, prénom As String, identifiant As String
'// Assignation BDD_personnes et affectations ....................................
Set BDD_personnes = Range("Personnes").Worksheet.ListObjects(1)
Set BDD_affectations = Range("Affectations").Worksheet.ListObjects(1)
' Initialisation année et mode ....................................
If sel_année <> 0 Then Me.tbx_année = sel_année
Cmd_Valider.Caption = "Créer"
'// création d'un dictionnaire des noms avec pour chaque nom le dictionnaire des prénoms correspondants
Set noms = CreateObject("Scripting.Dictionary")
With BDD_personnes
For i = 1 To .ListRows.Count
identifiant = .ListColumns("Identifiant").DataBodyRange.Rows(i)
nom = .ListColumns("Nom").DataBodyRange.Rows(i)
prénom = .ListColumns("Prénom").DataBodyRange.Rows(i)
If Not noms.exists(nom) Then Set noms(nom) = CreateObject("Scripting.Dictionary")
Set prénoms = noms(nom): prénoms(prénom) = identifiant: Set noms(nom) = prénoms
Next i
End With
Call tri_dico_AZ(noms)
'// Chargement Comboboxes ............................
Me.cbx_nom.List = noms.keys
If sel_nom <> Empty Then Me.cbx_nom = sel_nom: Me.cbx_prénom = sel_prénom
Me.cbx_tâche.List = Range("tâches").Value
'MsgBox VarType(Me.lbl_identifiant)
'// Remplissage ComboBox1 (période)
ComboBox1.AddItem "matin"
ComboBox1.AddItem "aprem"
End Sub |
Partager