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
| Option Compare Text
Dim bddfeuil1, plagefeuil5, critere
Private Sub TextBox1_Change()
Feuil5.Cells.Clear
Feuil5.[AA1] = bddfeuil1.Cells(1, critere)
Feuil5.[AA2] = Me.TextBox1.Value
Feuil1.[A1].CurrentRegion.AdvancedFilter Action:=xlFilterCopy, _
criteriarange:=Feuil5.[AA1:AA2], _
copytorange:=Feuil5.[A1], Unique:=False
If Feuil5.[A1].CurrentRegion.Row.Count > 1 Then
Set plagefeuil5 = Feuil5.[A1].curentregion.Offset(1).Resize(Feuil5.[A1].CurrentRegion.Rows.Count - 1)
Me.ListBox1.RowSource = plagefeuil5.adress(external:=True)
End If
End Sub
Private Sub userform_initialize()
ComboBox1.List = WorksheetFunction.Transpose(Feuil1.Range("A1:T1"))
End Sub
Private Sub CommandButton3_Click()
Unload Me
End Sub
Private Sub ComboBox1_Change()
For col = 1 To 20
If Feuil1.Cells(1, col).Value = Me.ComboBox1.Value Then
critere = col
End If
Next
Set bddfeuil1 = Feuil1.[A1].CurrentRegion
Me.ListBox1.ColumnCount = Feuil1.[A1].CurrentRegion.Columns.Count
Me.ListBox1.ColumnWidths = "5;5;5;5;5;5;5;5;5;5;5;5;5;5;5;5;5;5;5;5"
Me.ListBox1.ColumnHeads = True
Me.TextBox1.Text = ""
Me.TextBox1.SetFocus
End Sub |
Partager