Sub replace() For j = 1 To 5 For i = 1 To 5 If Sheets("Лист 1").Cells(j, 1) <> Sheets("Лист 2").Cells(i, 1) Then Sheets("Лист 1").Activate Sheets("Лист 1").Cells(j, 1).Select Selection.Copy Sheets("Лист 2").Activate Sheets("Лист 2").Cells(i, 1).Select ActiveSheet.Paste End If Next i Next j End Sub It is necessary that by pressing the macro check the value from Sheet 1 and if it is not the same as in Sheet 2, the macro copies the value from Sheet 1 to Sheet 2 into the corresponding cell, which is specified by the cycle. In my case, the macro replaces all the cells in Sheet 2 with the same number until it reaches the end. At the end of the range, it changes the number to the following from sheet 1. Please help
Sheets("Лист 1").Cells(j, 1) <> Sheets("Лист 2").Cells(i, 1)in one sheet i and in the other j - arif