The following code inserts a blank row and copies the text "Total" below the empty row. How could I make the code to insert a row and copy the text total to that row instead of inserting a blank row.
Code: Select all
Private Sub Worksheet_Change(ByVal Target As Range)
r = Target.Row
c = Target.Column
If c <> 1 Then Exit Sub
Application.EnableEvents = False
NextLineValue = Cells(r + 1, c)
If NextLineValue = "Total" Then
Rows(r + 1).Insert
End If
Application.EnableEvents = True
End Sub