Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Target.HasFormula Then Exit Sub 's'il n'y a pas de formule
Dim fich$, n1&, n2&, t1#, t2#, t3#, t4#
Cancel = True
fich = ThisWorkbook.Path & "\" & ThisWorkbook.Name
[IV1:IV8192].Formula = "=COUNTA(1,)"
[COLOR="Red"]t1 = Timer[/COLOR]
[IV1:IV8192].Replace 1, "A1", LookAt:=xlPart 'pour que les formules soient toutes différentes (en notation R1C1)
[COLOR="Red"]t2 = Timer[/COLOR]
ThisWorkbook.Save
n1 = FileLen(fich)
[COLOR="Red"]t3 = Timer[/COLOR]
[IV1:IV8192].Replace ",", "," & Mid(Target.Formula, 2, 9 ^ 9)
[COLOR="Red"]t4 = Timer[/COLOR]
ThisWorkbook.Save
n2 = FileLen(fich)
[IV1:IV8192].ClearContents
ThisWorkbook.Save
MsgBox "Nombre d'octets de la formule : " & Application.Round((n2 - n1) / 8192, 0)
[COLOR="Red"]MsgBox "Durée d'exécution de la formule (en µs) : " & Format(1000000 * IIf(t4 - t3 > t2 - t1, t4 - t3 - t2 + t1, 0) / 8192, "0.000")[/COLOR]
End Sub