Sub Affiche()
With Shapes(Application.Caller).ControlFormat
Shapes("_" & Replace(.LinkedCell, "$", "")).Visible = Range(.LinkedCell)
End With
End Sub
Sub AjusterHauteurLignes()
Dim r As Range, m As Range, h!, m1 As Range
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each r In [I12:I23,G34:G43]
r.RowHeight = 11.25 'RAZ, adapter au besoin
If r <> "" Then
Set m = r.MergeArea
m.UnMerge 'défusionne
m.HorizontalAlignment = xlCenterAcrossSelection
m.WrapText = True
r.Rows.AutoFit 'ajustement hauteur
h = m.RowHeight
m.Merge 'refusionne
m.RowHeight = h
m.HorizontalAlignment = xlLeft
End If
Next
For Each r In [G54:AG57].Rows
r.RowHeight = 11.25 'RAZ, adapter au besoin
If r.Cells(1) <> "" Or r.Cells(14) <> "" Then
Set m = r.Cells(1).MergeArea
Set m1 = r.Cells(14).MergeArea
r.UnMerge 'défusionne
m.HorizontalAlignment = xlCenterAcrossSelection
m1.HorizontalAlignment = xlCenterAcrossSelection
r.WrapText = True
r.Rows.AutoFit 'ajustement hauteur
h = r.RowHeight
m.Merge: m1.Merge 'refusionne
r.RowHeight = h
r.HorizontalAlignment = xlLeft
End If
Next
End Sub
Private Sub Worksheet_Activate()
Worksheet_Change [O4] 'lance la macro
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim lig As Variant, CelluleLiée, c As Range, i%
Application.ScreenUpdating = False
Application.EnableEvents = False
With Sheet9 'CodeName
lig = Application.Match([O4], .[A:A], 0)
If IsError(lig) Then lig = 1
CelluleLiée = Array("A7", "F7", "I7", "L7", "P7", "U7", "Y7", "AC7", "AG7", _
"F46", "I46", "L46", "P46", "U46", "A27", "D27", "G27", "K27", "M27", "Q27", "U27", "Y27", "AC27")
For Each c In Intersect(.Rows(lig), .[C:K,Y:AL])
Range(CelluleLiée(i)) = c = "Y"
Shapes("_" & CelluleLiée(i)).Visible = c = "Y"
i = i + 1
Next
End With
Application.EnableEvents = True
End Sub