Hello Glio,
The macros now allow for you delete lines, and still add new lines above the last formatted line. The macros have already been added to your buttons in the attached workbook.
Private Sub CommandButton1_Click()
Dim R As Long
R = 21
While Cells(R, "C").MergeCells = True
R = R + 1
Wend
Cells(R - 1, "C").EntireRow.Copy
Cells(R, "C").EntireRow.Insert
Application.CutCopyMode = False
End Sub
Private Sub CommandButton2_Click()
Dim R As Long
Dim Rng As Range
Set Rng = Range("C21:C10000").Find(What:="name", LookIn:=xlValues, LookAt:=xlWhole, _
SearchOrder:=xlRows, SearchDirection:=xlNext, MatchCase:=False)
If Rng Is Nothing Then
MsgBox "Apologies area not found or missing."
Exit Sub
End If
R = Rng.Row + 1
While Cells(R, "C").MergeCells = True
R = R + 1
Wend
Cells(R - 1, "C").EntireRow.Copy
Cells(R, "C").EntireRow.Insert
Application.CutCopyMode = False
End Sub
Sincerely,
Leith Ross
Bookmarks