1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| Sub AppliquerCR()
Dim LastLig As Long
With Sheets("Feuil1")
'Dernière ligne remplie de la colonne C à partir de C4
LastLig = .Range("C4").End(xlDown).Row
'Insère 4 lignes plus bas la fonction de calcul de rentabilité entre t1 et t0
.Cells(LastLig + 4, 3).Formula = "=CalculRent(C5,C4,D5)"
'Copie la fonction de t1 jusqu'à tmax
.Cells(LastLig + 4, 3).AutoFill .Range(.Cells(LastLig + 4, 3), .Cells(2 * LastLig - 1, 3))
'Copie la zone pour toutes les autres colonnes
.Range(.Cells(LastLig + 4, 3), .Cells(2 * LastLig - 1, 4)).Copy .Range(.Cells(LastLig + 4, 5), .Cells(2 * LastLig - 1, 66))
'Remplace les formules par les valeurs (éventuellement
.Range(.Cells(LastLig + 4, 3), .Cells(2 * LastLig - 1, 66)).Value = .Range(.Cells(LastLig + 4, 3), .Cells(2 * LastLig - 1, 66)).Value
End With
End Sub |
Partager