Sub Macro4() If ActiveCell.Interior.Color = RGB(255, 255, 0) Then Dim i As Long i = ActiveCell.Offset(0, -2).Value ActiveCell.Offset(2, -1).Resize(i, 1).Select Selection.Copy ActiveCell.Offset(0, 1).Range("A1").Select ActiveSheet.Paste ActiveCell.Offset(0, -1).Resize(i, 1).Select Application.CutCopyMode = False Selection.ClearContents ActiveCell.Offset(-2, 1).Range("A1").Select End If End Sub