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 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279
| Option Explicit
Option Compare Text
Dim Ws As Worksheet
Dim Colonne As Integer
Private Sub CommandButton4_Click()
Recherche
End Sub
Private Sub CommandButton6_Click()
If ListBox1.ListIndex = -1 Then
MsgBox "Aucune personne n'ait sélectionné"
End If
If Me.ListBox1.ListIndex <> -1 Then
Sheets("MATRICE").Activate
Sheets("MATRICE").Rows(Me.ListBox1.List(Me.ListBox1.ListIndex)).Select
Unload Me
End If
End Sub
Private Sub CommandButton7_Click()
With Sheets("Menuprincipale")
Range("C2") = TextBox1.Text
Range("F2") = TextBox2.Text
End With
Unload Me
End Sub
Private Sub CommandButton8_Click()
Dim Prem As String
Dim c As Range
With Me.ListBox1
.Clear
.ColumnCount = 2
.ColumnWidths = "0;100"
End With
With Worksheets("MATRICE").UsedRange
Set c = .Find(Me.TextBox14, LookIn:=xlValues, Lookat:=xlPart)
If Not c Is Nothing Then
Prem = c.Address
Do
With Me.ListBox1
.AddItem c.Row
.List(.ListCount - 1, 1) = c.Offset(, 2 - c.Column)
End With
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> Prem
End If
End With
If ListBox1.ListCount = 0 Then
MsgBox "Il n'existe pas dans la matrice"
End If
End Sub
Private Sub CommandButton9_Click()
If ListBox1.ListIndex = -1 Then
MsgBox "Aucune personne n'ait sélectionné"
End If
If Me.ListBox1.ListIndex <> -1 Then
Dim yourmsgbox As Integer
yourmsgbox = MsgBox("Veuillez confirmer la suppression définitive", vbOKCancel, "confirmation")
If yourmsgbox = vbCancel Then
Exit Sub
Else
Sheets("MATRICE").Rows(Me.ListBox1.List(Me.ListBox1.ListIndex)).EntireRow.Delete
End If
End If
Unload Me
End Sub
Private Sub ListBox1_Click()
If Me.ListBox1.ListIndex <> -1 Then
Me.TextBox1 = Sheets("MATRICE").Range("A" & Me.ListBox1.List(Me.ListBox1.ListIndex))
Me.TextBox15 = Sheets("MATRICE").Range("O" & Me.ListBox1.List(Me.ListBox1.ListIndex))
Me.TextBox2 = Sheets("MATRICE").Range("B" & Me.ListBox1.List(Me.ListBox1.ListIndex))
Me.TextBox8 = Sheets("MATRICE").Range("H" & Me.ListBox1.List(Me.ListBox1.ListIndex))
Me.TextBox9 = Sheets("MATRICE").Range("I" & Me.ListBox1.List(Me.ListBox1.ListIndex))
Me.TextBox12 = Sheets("MATRICE").Range("L" & Me.ListBox1.List(Me.ListBox1.ListIndex))
Me.TextBox46 = Sheets("MATRICE").Range("AT" & Me.ListBox1.List(Me.ListBox1.ListIndex))
Me.TextBox47 = Sheets("MATRICE").Range("AU" & Me.ListBox1.List(Me.ListBox1.ListIndex))
Me.TextBox5 = Sheets("MATRICE").Range("E" & Me.ListBox1.List(Me.ListBox1.ListIndex))
Me.TextBox18 = Sheets("MATRICE").Range("R" & Me.ListBox1.List(Me.ListBox1.ListIndex))
Me.TextBox44 = Sheets("MATRICE").Range("AR" & Me.ListBox1.List(Me.ListBox1.ListIndex))
Me.TextBox50 = Sheets("MATRICE").Range("AX" & Me.ListBox1.List(Me.ListBox1.ListIndex))
Me.TextBox49 = Sheets("MATRICE").Range("AW" & Me.ListBox1.List(Me.ListBox1.ListIndex))
Me.TextBox20 = Sheets("MATRICE").Range("T" & Me.ListBox1.List(Me.ListBox1.ListIndex))
Me.TextBox34 = Sheets("MATRICE").Range("AH" & Me.ListBox1.List(Me.ListBox1.ListIndex))
Me.TextBox21 = Sheets("MATRICE").Range("U" & Me.ListBox1.List(Me.ListBox1.ListIndex))
Me.TextBox22 = Sheets("MATRICE").Range("V" & Me.ListBox1.List(Me.ListBox1.ListIndex))
End If
End Sub
Private Sub OptionButton1_Click()
' Descriptions
Colonne = 1
'Recherche
End Sub
Private Sub OptionButton12_Click()
' Descriptions
Colonne = 12
'Recherche
End Sub
Private Sub OptionButton15_Click()
' Descriptions
Colonne = 15
'Recherche
End Sub
Private Sub OptionButton17_Change()
If Me.OptionButton17 = True Then
Me.CommandButton8.Visible = True
Else
Me.CommandButton8.Visible = False
End If
End Sub
Private Sub OptionButton18_Click()
' Descriptions
Colonne = 18
'Recherche
End Sub
Private Sub OptionButton2_Click()
' Descriptions
Colonne = 2
'Recherche
End Sub
Private Sub OptionButton20_Click()
' Descriptions
Colonne = 20
'Recherche
End Sub
Private Sub OptionButton21_Click()
' Descriptions
Colonne = 21
'Recherche
End Sub
Private Sub OptionButton22_Click()
' Descriptions
Colonne = 22
'Recherche
End Sub
Private Sub OptionButton34_Click()
' Descriptions
Colonne = 34
'Recherche
End Sub
Private Sub OptionButton44_Click()
' Descriptions
Colonne = 44
'Recherche
End Sub
Private Sub OptionButton46_Click()
' Descriptions
Colonne = 46
'Recherche
End Sub
Private Sub OptionButton47_Click()
' Descriptions
Colonne = 47
'Recherche
End Sub
Private Sub OptionButton50_Click()
' Descriptions
Colonne = 50
'Recherche
End Sub
Private Sub OptionButton5_Click()
' Descriptions
Colonne = 5
'Recherche
End Sub
Private Sub OptionButton8_Click()
' Descriptions
Colonne = 8
'Recherche
End Sub
Private Sub OptionButton9_Click()
' Descriptions
Colonne = 9
'Recherche
End Sub
Private Sub TextBox14_Change()
If Me.TextBox14 = "" Then
Me.CommandButton4.Locked = True
Me.CommandButton8.Locked = True
Else
Me.CommandButton4.Locked = False
Me.CommandButton8.Locked = False
End If
End Sub
Private Sub UserForm_Initialize()
Set Ws = Sheets("MATRICE")
With Me.ListBox1
.ColumnCount = 2
.ColumnWidths = "0;100"
End With
Me.OptionButton1 = True
End Sub
Sub Recherche()
Dim J As Long, NbLg As Long
Dim Tb1, Tb2()
Dim I As Integer, Indice As Integer
Me.ListBox1.Clear
NbLg = Ws.Range("A" & Rows.Count).End(xlUp).Row
Tb1 = Ws.Range("A2:EL" & NbLg)
For J = 1 To UBound(Tb1)
If Tb1(J, Colonne) Like "*" & Me.TextBox14 & "*" Then
Tb1(J, 6) = "X"
Indice = Indice + 1
End If
Next J
If Indice > 0 Then
ReDim Tb2(1 To Indice, 1 To 17)
Indice = 0
For J = 1 To UBound(Tb1)
If Tb1(J, 6) = "X" Then
Indice = Indice + 1
For I = 1 To 17
Tb2(Indice, I) = Tb1(J, I)
Next I
End If
Next J
With Me.ListBox1
.List() = Tb2
End With
End If
If ListBox1.ListCount = 0 Then
MsgBox "Il n'existe pas dans la matrice"
End If
End Sub |
Partager