Bonjour,
A essayer :
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim lig%, col%, lis%, lfin%
If Target.Column < 4 Or Target.Column > 6 Or Target.Row < 5 Then Exit Sub
If Target.Value = "" Then Exit Sub
lfin = Application.Match("FIN", Me.Columns(4), 0)
lig = Target.Row: col = Target.Column
lis = Application.Match("*", Me.Range(Cells(lig + 1, col), Cells(lfin, col)), 0) + lig
Me.Range(Cells(lig, col + 1), Cells(lis, col + 1)).SpecialCells(xlCellTypeConstants) _
.EntireRow.Hidden = False
Cancel = True
End Sub
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
Dim lig%, col%, lis%, lfin%
If Target.Column < 4 Or Target.Column > 6 Or Target.Row < 5 Then Exit Sub
If Target.Value = "" Then Exit Sub
lfin = Application.Match("FIN", Me.Columns(4), 0)
lig = Target.Row: col = Target.Column
lis = Application.Match("*", Me.Range(Cells(lig + 1, col), Cells(lfin, col)), 0) + lig
If col = 6 Then
If Me.Cells(lis - 2, col - 2) <> "" Then
lis = lis - 2
ElseIf Me.Cells(lis - 1, col - 1) <> "" Then
lis = lis - 1
End If
ElseIf col = 5 Then
If Me.Cells(lis - 1, col - 1) <> "" Then lis = lis - 1
End If
Me.Rows(lig + 1 & ":" & lis - 1).Hidden = True
Cancel = True
End Sub
Un léger aménagement : ligne 1145, col. D, E, F : le mot FIN (police à blanc pour le masquer). Si tu étends, tu recules les "FIN" à la fin !
(Et si tu dépasses 32000 lignes tu passes toutes les variables en Long (remplacer % par &)).
Cordialement.