Re : Filtre VB
voilà mon fichier!
et encore merci pour ton aide.
Sub fonction()
Dim Condition As Integer
Dim cond As Long
Dim conditions()
Dim recupconditions As Range
Dim j
Dim fleche As String
Dim recup
Condition = MsgBox("Avez vous une condition supplÈmentaire ‡ filtrer", vbYesNo, "contraintes")
j = 0
While Condition = vbYes
j = j + 1
ReDim Preserve conditions(1 To 3, 1 To j)
Set recupconditions = Application.InputBox(Title:="SÈlectionner la cellule de la condition", prompt:="condition", Type:=8)
fleche = InStr(recupconditions.Value, "->")
conditions(1, j) = -Left$(recupconditions.Value, fleche)
conditions(2, j) = 1 * Right(recupconditions.Value, fleche + 2)
conditions(3, j) = recupconditions.Column
Condition = MsgBox("Avez vous une condition supplÈmentaire ‡ filtrer", vbYesNo, "contraintes")
Wend
cond = j
If cond <> 0 Then
ActiveWorkbook.Worksheets("feui").Rows("4:4").Select
For i = 1 To cond
ActiveWorkbook.Worksheets("feui").Activate
Selection.AutoFilter Field:=CInt(conditions(3, i) - 5), Criteria1:="<=" & conditions(2, i), Operator:=xlAnd, _
Criteria2:=">=" & conditions(1, i)
End If
End Sub