Dim Tval(1) As Variant
Feuil1.select
Tval(1)= ActiveSheet.Name
'ou ActiveSheet.CodeName suivant le cas
Dim X As Integer
With ActiveWorkbook.VBProject.VBComponents(Tval(1)).CodeModule
X = .countOfLines
.InsertLines X + 1, 'Option Explicit'
.InsertLines X + 2, 'Sheets(''Feuil2'').Range(''D13'').Value = Sheets(''Tval(1)'').Range(''B12'').Value'
.InsertLines X + 3, 'End Sub'
End With