VBA - Filtre avancé

Bonjour à tous,

Le but après de cliquer sur le bouton actualiser c'est d'importer le nom du projet et les codes dudit projet selon la zone de liste déroulante qui se trouve à la cellule Q5

Merci d'avance

Bonjour Omarbel, le forum,

A tester:

Sub actualiser()
 Dim tb, Newtb, i, k, derlig
 Dim Projet, Annee

  With Sheets("Acceuil")
    derlig = .Range("C" & Rows.Count).End(xlUp).Row
   With .Shapes("Zone combinée 4").ControlFormat
    Projet = .List(.ListIndex): End With
   With .Shapes("Zone combinée 3").ControlFormat
    Annee = .List(.ListIndex): End With

    With Sheets("Liste")
     tb = .Range("A1").CurrentRegion
      k = 0
      ReDim Newtb(0 To UBound(tb, 1), 1 To 1)
       For i = 1 To UBound(tb, 1)
        If tb(i, 1) Like Projet And tb(i, 3) Like Annee Then
         Newtb(k, 1) = "Projet " & tb(i, 1) & " - " & tb(i, 2)
         k = k + 1
        End If
      Next i
    End With

   On Error Resume Next
    If derlig >= 11 Then .Range("C11:C" & derlig).ClearContents
    If k > 0 Then .Range("C11").Resize(k, 1).Value = Newtb
  End With

 Erase tb: Erase Newtb
End Sub
10omarbel.xlsm (28.48 Ko)

Cordialement,

Rechercher des sujets similaires à "vba filtre avance"