У меня есть этот макрос, который находит фрагменты и подходит для моей программы:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim KeyCells As Range
' The variable KeyCells contains the cells that will
' cause an alert when they are changed.
Set KeyCells = Range("N19")
If Not Application.Intersect(KeyCells, Range(Target.Address)) _
Is Nothing Then
Dim vNew As Integer
Dim vOld As Integer
vNew = Range("N19").Value
Application.EnableEvents = False
Application.Undo
vOld = Range("N19").Value
Range("N19").Value = vNew
Range("D159").Value = vOld
Application.EnableEvents = True
End If
End Sub
Мне нужно сохранить старое значение N19 в D159.
Знаете ли вы, почему этоне работает?
Спасибо