Bonjour à tous et Meilleurs Voeux 2016
Un petit problème:
Sur une feuille de classeur qui récupère toutes les données d'INTERVENTIONS j'ai un USF qui m'affiche toutes les interventions. (sur 18 colonnes de A à R)
Moi je ne voudrais que la liste dont la colonne M est vide et avec les colonnes de A à G et de M à O
Pour info: sur la feuille INTERVENTIONS, la ligne 2 comporte les ENTETES et les données commencent à la ligne 3
Les codes du dessous ne sont pas de moi, mais récupérés et adaptés
Merci d'avance
CODE USF:
CODE Module Classe:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 Dim nbcol Dim Lbl(1 To 18) As New ClasseSaisieInterv Private Sub Btn_Fermer_Click() Unload Me End Sub Private Sub UserForm_Initialize() Set F = Sheets("INTERVENTIONS") nbcol = F.[A2].CurrentRegion.Columns.Count Me.ListBox1.ColumnCount = nbcol Set plage = F.[A2].CurrentRegion Set plage = plage.Offset(2).Resize(plage.Rows.Count - 1) 'plage.offset(2) signifie que l'on commence à la ligne 2+1) Me.ListBox1.List = plage.Value I = 1 x = 18 For I = 1 To nbcol retour = Me.Controls.Add("Forms.Label.1", "Label" & I, True) Me("label" & I).Caption = F.Cells(2, I) Me("label" & I).Top = 55 Me("label" & I).Left = x x = x + F.Columns(I).Width * 1.1 temp = temp & F.Columns(I).Width * 1.1 & ";" Next Me.ListBox1.ColumnWidths = temp For b = 1 To nbcol: Set Lbl(b).GrLabel2 = Me("Label" & b): Next b End Sub Private Sub TextBox1_Change() Me.ListBox1.Clear I = 0 Set plage = F.[b1].CurrentRegion Set plage = plage.Offset(1).Resize(plage.Rows.Count - 1) Set C = plage.Find(Me.TextBox1, , , xlPart) If Not C Is Nothing Then premier = C.Address Do Me.ListBox1.AddItem lig = C.Row - plage.Row + 1 For col = 1 To nbcol Me.ListBox1.List(I, col - 1) = plage.Cells(lig, col) Next col I = I + 1 Set C = plage.FindNext(C) Loop While Not C Is Nothing And C.Address <> premier End If End Sub Private Sub B_tout_Click() UserForm_Initialize For I = 1 To nbcol Me("label" & I).ForeColor = vbBlack Next I End Sub
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 Public WithEvents GrLabel2 As MSForms.Label Private Sub GrLabel2_Click() nbcol = Sheets("INTERVENTIONS").[A2].CurrentRegion.Columns.Count temp = GrLabel2.Name col = Val(Mid(temp, 18)) If IsNumeric(F.Cells(3, col)) Then num = True Else num = False For I = 1 To nbcol Recap_Interventions("label" & I).ForeColor = vbBlack Next I Recap_Interventions(temp).ForeColor = vbRed Dim a() a = Recap_Interventions.ListBox1.List nbcol = UBound(a, 2) - LBound(a, 2) + 1 If col <> OrdreAncien Then ordre = False Call TriCD(a(), UBound(a), col - 1, Not ordre, nbcol, num) ordre = Not ordre OrdreAncien = col Recap_Interventions.ListBox1.List = a End Sub
Partager