My coding
Private Sub Worksheet_Change(ByVal Target As Range) 'If Target.Column = 1 Or Target.Column = 2 Then 'if index don't exists, then pass in the last row index with last column index) summary_row = Sheet1.Cells(Rows.Count, "a").End(xlUp).row index_row = Sheet2.Cells(Rows.Count, "a").End(xlUp).row lastCol = Sheet2.Cells(1, Columns.Count).End(xlToLeft).Column i = indexCell(Target.row, summary_row, index_row) MsgBox (i) MsgBox (summary_row) If i <> summary_row Then MsgBox (i) MsgBox (Target.row) Call FillCells(i, Target.row, lastCol) Else Call FillCells(summary_row + 1, index_row, lastCol) End If 'if index exists, then pass in pass in the existed row index with last column index) 'Call FillCells(existrow, lastCol) 'End If End Sub Public Function indexCell(ByVal selected_row As Integer, ByVal summary_lastrow As Integer, ByVal index_lastrow As Integer) As Integer Dim j As Integer j = summary_lastrow...