Microsoft 365 Afficher et cacher des cellules

Amymone

XLDnaute Nouveau
Bonsoir le forum

J'ai un début de macro qui cache les cellules vides, cependant comment modifier la macro pour qu'elle cache aussi le deuxième tableau
Il faut cependant toujours prendre en compte le 1° tableau, j'espère que c'est explicite
je suis novice dans ce domaine et j'ai besoin de votre aide
Merci
 

Pièces jointes

  • Classeur17xhjol.xlsm
    22.3 KB · Affichages: 2

Chris401

XLDnaute Accro
Bonsoir
Il suffit d'ajouter les plages du 2ème tableau
VB:
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
If CommandButton1.Caption = "Cacher" Then
        CommandButton1.BackColor = &HFFC0C0
        CommandButton1.Caption = "Afficher"
Range("D9:D17,D22:D31").Select
For Each o In Selection
If o.Value = "" Then
o.EntireRow.Hidden = True
End If
Next
Range("E9").Select

Else
        CommandButton1.Caption = "Cacher"
        CommandButton1.BackColor = &HFF&

[D9:D17,D22:D31].EntireRow.Hidden = False
Range("E9").Select
End If


Application.ScreenUpdating = True

End Sub
 

Discussions similaires

Statistiques des forums

Discussions
312 224
Messages
2 086 410
Membres
103 201
dernier inscrit
centrale vet