Formule In_Array

Bonjour,

Mon objectif est de savoir si l'ensemble de mes références sont présentes dans ma colonne pour une date donnée. J'ai trouvé cette fonction "in_array" sur votre site :

https://www.excel-pratique.com/fr/astuces_vba/recherche-tableau-array.php

Cependant, intégrer dans mon code ça ne fonctionne pas.

Sub test()

Dim D_Date As Date
Dim L_I As Long
Dim L_dLignes As Long
Dim L_Cnt As Long

maplage = Sheets("Dictionnaire").Range("A2:A16")

D_Date = Worksheets("Màj Data").Range("A4")

L_dLignes = Worksheets("Vbilan Vboursière").Cells(Application.Rows.Count, 1).End(xlUp).Row

Worksheets("Vbilan Vboursière").Activate

tableau = Array(maplage)

For I = 3 To L_dLignes

If Range("E" & I) = D_Date Then

  If in_array(tableau, Range("F" & I)) Then
  L_Cnt = L_Cnt + 1
  Else: L_Cnt = L_Cnt + 0
  End If

End If

Next

Range("Q10") = L_Cnt

End Sub

Merci d'avance pour votre aide.

Très bonne journée,

Léa

bonjour,

essaie ainsi

Sub test()

    Dim D_Date As Date
    Dim L_I As Long
    Dim L_dLignes As Long
    Dim L_Cnt As Long

    tableau = Application.Transpose(Sheets("Dictionnaire").Range("A2:A16"))

    D_Date = Worksheets("Màj Data").Range("A4")

    With Worksheets("Vbilan Vboursière")
        L_dLignes = .Cells(Application.Rows.Count, 1).End(xlUp).Row

        For I = 3 To L_dLignes

            If .Range("E" & I) = D_Date Then

                If in_array(tableau, .Range("F" & I)) Then
                    L_Cnt = L_Cnt + 1

                End If

            End If

        Next

        .Range("Q10") = L_Cnt
    End With
End Sub

Bonjour,

En effet, ça fonctionne parfaitement !

Merci beaucoup.

Léa

Rechercher des sujets similaires à "formule array"