masquer ligne si certaine cellules vides

jean de chez claude

XLDnaute Junior
Bonjour le forum
Je souhaiterais inclure dans une macro une formule qui permettrait de masquer toutes les lignes dont certaines cellules sont vides, voit fichier ci-joint.
Merci d’avance pour votre aide
 

Pièces jointes

  • Exemp.xls
    26.5 KB · Affichages: 65
  • Exemp.xls
    26.5 KB · Affichages: 60
  • Exemp.xls
    26.5 KB · Affichages: 62

mth

XLDnaute Barbatruc
Re : masquer ligne si certaine cellules vides

Bonjour,

Un exemple ci-joint, à l'aide le la fonction NBVAL() et d'un filtre automatique.
Vois ci cela peut t'être utile,

Bien à toi,

mth

Edit: :) Hello Efgé :)
 

Pièces jointes

  • Exemp(1).xls
    26 KB · Affichages: 107
  • Exemp(1).xls
    26 KB · Affichages: 108
  • Exemp(1).xls
    26 KB · Affichages: 108
Dernière édition:

Efgé

XLDnaute Barbatruc
Re : masquer ligne si certaine cellules vides

Bonjour jean de chez claude, Bonjour mth:)
Une proposition par macro:
Code:
Sub test()
Dim i&, X&, Y&
Dim Plg1 As Range, Plg2 As Range
Application.ScreenUpdating = 0
With Sheets("Feuil1")
    For i = 4 To .Cells(Rows.Count, 1).End(xlUp).Row
        Set Plg1 = .Range(.Cells(i, 3), .Cells(i, 7))
        Set Plg2 = .Range(.Cells(i, 11), .Cells(i, 15))
        Y = WorksheetFunction.Sum(Plg1)
        X = WorksheetFunction.Sum(Plg2)
        Rows(i).Hidden = X + Y = 0
    Next i
End With
Application.ScreenUpdating = 1
End Sub
Cordialement

Edit
Que l'on peut réduire à:
Code:
Sub test_2()
Dim i&
Application.ScreenUpdating = 0
With Sheets("Feuil1")
    For i = 4 To .Cells(Rows.Count, 1).End(xlUp).Row
        Rows(i).Hidden = WorksheetFunction.Sum(.Range(.Cells(i, 3), .Cells(i, 7))) + _
        WorksheetFunction.Sum(.Range(.Cells(i, 11), .Cells(i, 15))) = 0
    Next i
End With
Application.ScreenUpdating = 1
End Sub
 
Dernière édition:

Discussions similaires

Statistiques des forums

Discussions
312 338
Messages
2 087 396
Membres
103 534
dernier inscrit
Kalamymustapha