Sub Convertir_F_ref_absolue()
Dim Mycell As Range
For Each Mycell In ActiveSheet.UsedRange
If Len(Mycell.Formula) > 0 Then
'Stores cell's formula as variable
MyFormula = Mycell.Formula
'Converts formula to absolute reference style
NewFormula = Application.ConvertFormula _
(Formula:=MyFormula, _
fromReferenceStyle:=xlA1, _
toReferenceStyle:=xlA1, _
toAbsolute:=xlAbsolute)
'Replaces old formula with new absolute formula
Mycell.Formula = NewFormula
End If
Next
End Sub
Sub Convertir_ref_absolue_REL()
Dim Mycell As Range
Dim Plage As Range
Set Plage = Application.InputBox(Prompt:= _
"Veuillez sélectionner les cellules à convertir", _
Title:="Convertion en références relatives", Type:=8)
For Each Mycell In Plage
If Len(Mycell.Formula) > 0 Then
MyFormula = Mycell.Formula
NewFormula = Application.ConvertFormula _
(Formula:=MyFormula, _
fromReferenceStyle:=xlA1, _
toReferenceStyle:=xlA1, _
toAbsolute:=xlRelative)
Mycell.Formula = NewFormula
End If
Next
End Sub