Compter une sélection de ligne avec macro Excel 2003
2 réponses
benoitdubourg
Bonjour =E0 tous,
je travaille sur un tableau contenant par exemple 800 lignes.
J'utilise la fonction Filtrer / automatique, et je me retrouve avec
par exemple 10 lignes, ou m=EAme juste l'entete.
L'en-t=EAte du tableau est fixe.
Je voudrais qu'une variable dans mes macros me calcule le nombre de
ligne r=E9sultant du filtre.
Actuellement j'utilise :
NbLignes =3D Selection.Rows.Count
mais ce r=E9sultat ne prends pas en compte les lignes filtr=E9es.
Avez vous une astuce ? Merci d'avance et bonne journ=E9e.
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
FdeCourt
Salut,
Avec ce type de code, cela conviendrait-il ?
Function CompteLignesVisible() As Long Dim x As Long, h As Long For x = 2 To Cells(65536, 1).End(xlUp).Row If Rows(x).Hidden = False Then h = h + 1 End If Next CompteLignesVisible = h
End Function
Cordialement,
F.
Salut,
Avec ce type de code, cela conviendrait-il ?
Function CompteLignesVisible() As Long
Dim x As Long, h As Long
For x = 2 To Cells(65536, 1).End(xlUp).Row
If Rows(x).Hidden = False Then
h = h + 1
End If
Next
CompteLignesVisible = h
Function CompteLignesVisible() As Long Dim x As Long, h As Long For x = 2 To Cells(65536, 1).End(xlUp).Row If Rows(x).Hidden = False Then h = h + 1 End If Next CompteLignesVisible = h
End Function
Cordialement,
F.
Ben de Pont-Aven, ça farte !!!
On 9 avr, 16:23, FdeCourt wrote:
Salut,
Avec ce type de code, cela conviendrait-il ?
Function CompteLignesVisible() As Long Dim x As Long, h As Long For x = 2 To Cells(65536, 1).End(xlUp).Row If Rows(x).Hidden = False Then h = h + 1 End If Next CompteLignesVisible = h
End Function
Cordialement,
F.
Parfait ! Merci de votre rapidité ! Et ca marche nickel ! @+
On 9 avr, 16:23, FdeCourt <fdeco...@gmail.com> wrote:
Salut,
Avec ce type de code, cela conviendrait-il ?
Function CompteLignesVisible() As Long
Dim x As Long, h As Long
For x = 2 To Cells(65536, 1).End(xlUp).Row
If Rows(x).Hidden = False Then
h = h + 1
End If
Next
CompteLignesVisible = h
End Function
Cordialement,
F.
Parfait ! Merci de votre rapidité ! Et ca marche nickel !
@+
Function CompteLignesVisible() As Long Dim x As Long, h As Long For x = 2 To Cells(65536, 1).End(xlUp).Row If Rows(x).Hidden = False Then h = h + 1 End If Next CompteLignesVisible = h
End Function
Cordialement,
F.
Parfait ! Merci de votre rapidité ! Et ca marche nickel ! @+