Attribute VB_Name = "Module1" Public Sub LaskeHinnat() Dim Rivi As Long Dim Muutos As Double Rivi = 5 Muutos = 1 + Sheets("Hinnasto").Range("C1").Value Do While Sheets("Hinnasto").Range("A" & Rivi).Value <> "" Range("C" & Rivi).Value = Range("C" & Rivi).Value * Muutos Rivi = Rivi + 1 Loop Application.OnUndo "Peruuta hinnanmuutos", "LaskeHinnat_Undo" End Sub Public Sub LaskeHinnat_Undo() Dim Rivi As Long Dim Muutos As Double Rivi = 5 Muutos = 1 / (1 + Sheets("Hinnasto").Range("C1").Value) Do While Sheets("Hinnasto").Range("A" & Rivi).Value <> "" Range("C" & Rivi).Value = Range("C" & Rivi).Value * Muutos Rivi = Rivi + 1 Loop Application.OnRepeat "Hinnanmuutos", "LaskeHinnat" End Sub