Compter nombre de ligne ou colonne A = "x"

Résolu/Fermé
bidounet84 Messages postés 416 Date d'inscription jeudi 28 août 2008 Statut Membre Dernière intervention 22 mai 2023 - 23 janv. 2018 à 17:56
bidounet84 Messages postés 416 Date d'inscription jeudi 28 août 2008 Statut Membre Dernière intervention 22 mai 2023 - 23 janv. 2018 à 20:13
Bonjour,

Bonjour,
Comme le titre l'indique je cherche à compter le nombre de ligne où la cellule = x.
J'ai mis ce code mais çà ne fonctionne pas où çà coince ?

For i = 1 To ligne_FICHE_total
If (onglet_Fiche.Columns("A") = "x") Then
ligne_FICHE = ligne_FICHE + 1
End If
Next

A voir également:

2 réponses

cs_Le Pivert Messages postés 7903 Date d'inscription jeudi 13 septembre 2007 Statut Contributeur Dernière intervention 11 mars 2024 728
23 janv. 2018 à 18:15
Bonjour,

voir ceci:

https://www.developpez.net/forums/d605223/logiciels/microsoft-office/excel/contribuez/boucles-parcourir-colonne-ligne-plage-donnees-2-methodes/


Ce qui donne cela:

Sub For_X_to_Next_Ligne()
Dim FL1 As Worksheet, NoCol As Integer
Dim NoLig As Long, Var As Variant
Dim nombre As Integer
    Set FL1 = Worksheets("Feuil1")
    NoCol = 1 'lecture de la colonne 1
    For NoLig = 1 To Split(FL1.UsedRange.Address, "$")(4)
        Var = FL1.Cells(NoLig, NoCol)
        If Var = "x" Then
        nombre = nombre + 1
        End If
    Next
    MsgBox nombre
    Set FL1 = Nothing
End Sub


0
bidounet84 Messages postés 416 Date d'inscription jeudi 28 août 2008 Statut Membre Dernière intervention 22 mai 2023 80
23 janv. 2018 à 20:13
Merci pour la solution
0