XL 2016 Intersection colonnes et lignes

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

Seddiki_adz

XLDnaute Impliqué
Bonjour
j'ai besoin d'aide
J'ai un classeur comprend deux feuils
Feuil1 comprend trois colonnes A,B,C
Feuil2 : la colonne A et ligne B
L'intersection de colonne A et ligne B donne la valeur C
Merci
 

Pièces jointes

Il ne faut pas supprimer les lignes mais les masquer.

Voyez le fichier joint et la macro du bouton :
VB:
Private Sub CommandButton1_Click() 'Masquer ou Afficher
Dim test As Boolean, r As Range
test = CommandButton1.Caption = "Masquer"
Application.ScreenUpdating = False
For Each r In [B2:G15,B19:G32].Rows 'plages à adapter
    r.Hidden = test And Application.Sum(r) = 0
Next
CommandButton1.Caption = IIf(test, "Afficher", "Masquer")
End Sub
 

Pièces jointes

M
Il ne faut pas supprimer les lignes mais les masquer.

Voyez le fichier joint et la macro du bouton :
VB:
Private Sub CommandButton1_Click() 'Masquer ou Afficher
Dim test As Boolean, r As Range
test = CommandButton1.Caption = "Masquer"
Application.ScreenUpdating = False
For Each r In [B2:G15,B19:G32].Rows 'plages à adapter
    r.Hidden = test And Application.Sum(r) = 0
Next
CommandButton1.Caption = IIf(test, "Afficher", "Masquer")
End Sub
Merci
EN peut masquer les colonnes vides ?
j'ai triuver ce code

Option Compare Text
Sub Masquer()
Dim Scope()
Scope = Array("stock initial", "entrees", "sorties", "stock", "mini", "état de stock")
nrows = ActiveSheet.UsedRange.Rows.Count
For Each Column In Columns
If IsInArray(Column.Cells(1), Scope) Then
If WorksheetFunction.CountA(Column.Cells(3).Resize(nrows - 2)) = 0 Then Column.Hidden = True
End If
Next
End Sub
Function IsInArray(Objet As String, Crit())
IsInArray = True
For Each Elem In Crit
If Trim(Objet) = Elem Then Exit Function
Next
IsInArray = False
End Function
Sub Afficher_tout()
Sheets("stock").Columns.Hidden = False
End Sub
 
Dernière édition:
EN peut masquer les colonnes vides ?
Cela ne paraît pas très judicieux car il peut y avoir des choses à ne pas masquer sous les colonnes.

Mais bon on peut toujours utiliser :
VB:
Private Sub CommandButton1_Click() 'Masquer ou Afficher
Dim test As Boolean, r As Range
test = CommandButton1.Caption = "Masquer"
Application.ScreenUpdating = False
For Each r In [B2:G15,B19:G32].Rows 'plages à adapter
    r.Hidden = test And Application.Sum(r) = 0
Next
For Each r In [B2:G15,B19:G32].Columns
    r.Hidden = test And Application.Sum(r) = 0
Next
CommandButton1.Caption = IIf(test, "Afficher", "Masquer")
End Sub
 

Pièces jointes

Cela ne paraît pas très judicieux car il peut y avoir des choses à ne pas masquer sous les colonnes.

Mais bon on peut toujours utiliser :
VB:
Private Sub CommandButton1_Click() 'Masquer ou Afficher
Dim test As Boolean, r As Range
test = CommandButton1.Caption = "Masquer"
Application.ScreenUpdating = False
For Each r In [B2:G15,B19:G32].Rows 'plages à adapter
    r.Hidden = test And Application.Sum(r) = 0
Next
For Each r In [B2:G15,B19:G32].Columns
    r.Hidden = test And Application.Sum(r) = 0
Next
CommandButton1.Caption = IIf(test, "Afficher", "Masquer")
End Sub
Excellent
Merci bq
 
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD

Discussions similaires

  • Résolu(e)
Microsoft 365 DATEDIF
Réponses
11
Affichages
184
  • Résolu(e)
Microsoft 365 DateDif()
Réponses
5
Affichages
170
Réponses
7
Affichages
116
Réponses
6
Affichages
198
Réponses
5
Affichages
116
  • Question Question
Microsoft 365 MFC dans tableau
Réponses
2
Affichages
224
Réponses
6
Affichages
158
Réponses
14
Affichages
667
Réponses
5
Affichages
399
Réponses
12
Affichages
247
Retour