Sub Coeffi()
Dim ref As Range
Dim deb, bas, fx
On Error Resume Next
Set ref = Application.InputBox(prompt:="Selectionner la première matrice (Colonne AA à AB).", Type:=8)
If Err > 0 Then Exit Sub
deb = Split(ref.Address, "$")(2)
bas = Split(ref.Address, "$")(4)
fx = "=Toit!R" & deb & "C27:R" & bas & "C29"
On Error Resume Next
ActiveWorkbook.Names("MatriceX").RefersToR1C1 = fx
If Err > 0 Then ActiveWorkbook.Names.Add Name:="MatriceX", RefersToR1C1:=fx
Dim asdf As Range
Dim com, fin, fy
On Error Resume Next
Set asdf = Application.InputBox(prompt:="Selectionner la deuxième matrice (Colonne AE).", Type:=8)
If Err > 0 Then Exit Sub
com = Split(ref.Address, "$")(2)
fin = Split(ref.Address, "$")(4)
fy = "=Toit!R" & deb & "C27:R" & bas & "C29"
On Error Resume Next
ActiveWorkbook.Names("MatatriceY").RefersToR1C1 = fx
If Err > 0 Then ActiveWorkbook.Names.Add Name:="MatriceY", RefersToR1C1:=fy
Range("A1:A3").Select
Selection.FormulaArray = _
"=MMULT(MINVERSE(MMULT(TRANSPOSE(MatriceX),MatriceX)),MMULT(TRANSPOSE(MatriceX),MatriceY))"
End Sub