Sub Groupe()
For NCol = 1 To 5 ' Fait le test sur les 5 premières colonnes
Ny = Application.CountIf(Range(Cells(24, NCol), Cells(1048576, NCol)), "Y") ' compte de bnre de Y de L24 à la fin
If Ny = 1048553 Then ' Si nombre de "Y" est egal à 1048576-24 alors
Columns(NCol).Columns.Group ' On applique Grouper à la colonne
ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=1
End If
Next NCol
End Sub