alolaterre
XLDnaute Nouveau
Bonjour,
débutant en macro je cherche à masquer les lignes qui ne servent à rien dans un devis que je propose à mes clients.
Je souhaite juste attribuer à 2 boutons (afficher et masquer) une macro qui permet d'un simple clic de masquer les lignes pour lesquels la quantité est 0. Et un autre pour rafficher le tout.
J'ai cherché plusieurs macro, mais je n'arrive pas à l'adapter à mon cas.
J'ai trouvé celle ci, qui semble correspondre le plus à mon fichier mais je n'arrive pas à l'apliquer:
Sub Masquer()
Application.ScreenUpdating = False
With ActiveSheet
For Each cel In .Range("A10:A65536").SpecialCells(xlCellTypeConstants)
If cel.Offset(0, 5).Value = 0 Or cel.Value = "" Then
cel.EntireRow.Hidden = True
Else
cel.EntireRow.Hidden = False
End If
Next
End With
Application.ScreenUpdating = True
End Sub
Sub Afficher()
Application.ScreenUpdating = False
With ActiveSheet
For Each cel In .Range("A:A").SpecialCells(xlCellTypeConstants)
cel.EntireRow.Hidden = False
Next
End With
Application.ScreenUpdating = True
End Sub
Pour moi, les quantités se trouve dans la colonne B
Merci par avance
débutant en macro je cherche à masquer les lignes qui ne servent à rien dans un devis que je propose à mes clients.
Je souhaite juste attribuer à 2 boutons (afficher et masquer) une macro qui permet d'un simple clic de masquer les lignes pour lesquels la quantité est 0. Et un autre pour rafficher le tout.
J'ai cherché plusieurs macro, mais je n'arrive pas à l'adapter à mon cas.
J'ai trouvé celle ci, qui semble correspondre le plus à mon fichier mais je n'arrive pas à l'apliquer:
Sub Masquer()
Application.ScreenUpdating = False
With ActiveSheet
For Each cel In .Range("A10:A65536").SpecialCells(xlCellTypeConstants)
If cel.Offset(0, 5).Value = 0 Or cel.Value = "" Then
cel.EntireRow.Hidden = True
Else
cel.EntireRow.Hidden = False
End If
Next
End With
Application.ScreenUpdating = True
End Sub
Sub Afficher()
Application.ScreenUpdating = False
With ActiveSheet
For Each cel In .Range("A:A").SpecialCells(xlCellTypeConstants)
cel.EntireRow.Hidden = False
Next
End With
Application.ScreenUpdating = True
End Sub
Pour moi, les quantités se trouve dans la colonne B
Merci par avance