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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
|
Private Sub UserForm_Initialize()
FrmFich.Caption = "test"
AfficheTitleBarre Me.Caption, False
FrmFich.Height = 555
FrmFich.Zoom = 95
End Sub
Private Sub CmbMAJ_Click()
Load FrmPass
FrmPass.Show
End Sub
Private Sub CmbVal_Click()
Dim TheCellFind As Range
'Ici on va rechercher la ligne a modifier
'Pour l'adhérent dans un 1er temps
Set TheCellFind = Sheets("Adhé").Range("T4:T" & Range("T" & Rows.Count).End(xlUp).Row).Find(ComboBox1.Value)
If TheCellFind Is Nothing Then Exit Sub 'y'a un soucis le nom existe forcement
'Ici il faut modifier les cellules correspondantes au infos inscrites dans les textbox
With TheCellFind ' a l'inverse de Combobox1_change
.Offset(0, -18) = C1.Value 'Inutil d'utiliser Controls(...).Value, autant mettre directement le nom du control
.Offset(0, -15) = C2.Value
.Offset(0, -11) = C3.Value
.Offset(0, -12) = C4.Value
.Offset(0, -10) = C5.Value
.Offset(0, -4) = C6.Value
.Offset(0, -5) = C7.Value
.Offset(0, -3) = C8.Value
.Offset(0, -2) = C9.Value
.Offset(0, -13) = C10.Value
.Offset(0, -7) = C11.Value
.Offset(0, -6) = C12.Value
.Offset(0, -14) = C13.Value
.Offset(0, -9) = C14.Value
.Offset(0, -8) = C15.Value
End With
End Sub
Private Sub ComboBox1_Change()
Dim adherent As Variant
Dim conj As Variant
Dim enf As Variant
Dim num As Variant
Dim x As Byte
Dim y As Byte
Dim z As Byte
For x = 1 To 10: Controls("C" & (x)) = "": Next x
For y = 1 To 4: Controls("D" & (y)) = "": Next y
For z = 1 To 30: Controls("T" & (z)) = "": Next z
num = 1
For Each adherent In Range("T4:T" & Range("T" & Rows.Count).End(xlUp).Row) 'Attention ici faut commencer a T2 et non T4
If adherent = ComboBox1.Value Then
Controls("C" & num).Value = adherent.Offset(0, -18)
Controls("C" & num + 1).Value = adherent.Offset(0, -15)
Controls("C" & num + 2).Value = adherent.Offset(0, -11)
Controls("C" & num + 3).Value = adherent.Offset(0, -12)
Controls("C" & num + 4).Value = adherent.Offset(0, -10)
Controls("C" & num + 5).Value = adherent.Offset(0, -4)
Controls("C" & num + 6).Value = adherent.Offset(0, -5)
Controls("C" & num + 7).Value = adherent.Offset(0, -3)
Controls("C" & num + 8).Value = adherent.Offset(0, -2)
Controls("C" & num + 9).Value = adherent.Offset(0, -13)
Controls("C" & num + 10).Value = adherent.Offset(0, -7)
Controls("C" & num + 11).Value = adherent.Offset(0, -6)
Controls("C" & num + 12).Value = adherent.Offset(0, -14)
Controls("C" & num + 13).Value = adherent.Offset(0, -9)
Controls("C" & num + 14).Value = adherent.Offset(0, -8)
End If
Next
For Each conj In Sheets("Conj").Range("C2:C" & Range("C" & Rows.Count).End(xlUp).Row)
If conj = ComboBox1.Value Then
Controls("D" & num).Value = conj.Offset(0, 1)
Controls("D" & num + 1).Value = conj.Offset(0, 4)
Controls("D" & num + 2).Value = conj.Offset(0, 5)
Controls("D" & num + 3).Value = conj.Offset(0, 6)
End If
Next
For Each enf In Sheets("Enf").Range("C3:C3" & Range("C" & Rows.Count).End(xlUp).Row)
If enf = ComboBox1.Value Then
Controls("T" & num).Value = enf.Offset(0, 2)
Controls("T" & num + 1).Value = enf.Offset(0, 3)
Controls("T" & num + 2).Value = enf.Offset(0, 4)
Controls("T" & num + 3).Value = enf.Offset(0, 7)
Controls("T" & num + 4).Value = enf.Offset(0, 5)
num = num + 5
End If
Next
End Sub
Private Sub CommandButton3_Click()
Unload Me
Sheets("Accueil").Visible = True
Sheets("1").Visible = False
Sheets("Adhé").Visible = False
Sheets("Conj").Visible = False
Sheets("Enf").Visible = False
Sheets("Accueil").Activate
End Sub
Private Sub UserForm_Activate()
Dim Tablo As Variant, Tempo As Variant, i As Long, j As Long
Worksheets("Adhé").Activate 'à défaut d'instancier la feuille
Tablo = Range("T2:T" & Range("T" & Rows.Count).End(xlUp).Row).Value
'triAlpha
For i = 1 To UBound(Tablo)
For j = 1 To UBound(Tablo)
If Tablo(i, 1) < Tablo(j, 1) Then
Tempo = Tablo(i, 1)
Tablo(i, 1) = Tablo(j, 1)
Tablo(j, 1) = Tempo
End If
Next j
Next i
'Remplissage excluant les doublons
CmbNom.AddItem Tablo(1, 1)
For i = 2 To UBound(Tablo)
If Tablo(i, 1) <> Tablo(i - 1, 1) Then CmbNom.AddItem Tablo(i, 1)
Next
FrmFich.CmbVal.Visible = False
'Les frames sont rendues inaccessibles
Frame1.Enabled = False
Frame2.Enabled = False
Frame3.Enabled = False
FrmFich.Height = 610
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = 0 Then
Cancel = True
End If
End Sub |