Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
If Target.Count > 1 Or Target(1).HasFormula Then Exit Sub
With ThisWorkbook.Names
.Add "CelRef", Target, Visible:=False 'nom défini masqué
.Add "CelW", Target.ColumnWidth, Visible:=False 'nom défini masqué
.Add "CelH", Target.RowHeight, Visible:=False 'nom défini masqué
End With
Target.ColumnWidth = 70
Target.RowHeight = 200
End Sub
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
If TypeName([CelRef]) <> "Range" Then Exit Sub
[CelRef].ColumnWidth = [CelW]
[CelRef].RowHeight = [CelH]
ThisWorkbook.Names("CelRef").Delete 'supprime le nom défini
End Sub
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Workbook_SheetSelectionChange Sh, Target 'lance la macro
End Sub