try this:
![]()
Sub InsertAfterDup() Dim i As Long, M_ax As Long Range("$A$2").Select i = 0 M_ax = 0 While ActiveCell.Offset(i, 0) <> "" If ActiveCell.Offset(i, 1) > M_ax Then M_ax = ActiveCell.Offset(i, 1) If InStr(1, ActiveCell.Offset(i, 0), "dup", vbTextCompare) <> 0 Then i = i + 1 ActiveCell.Offset(i, 0).EntireRow.Insert ActiveCell.Offset(i, 0) = ActiveCell.Offset(i - 1, 0) & "_max" ActiveCell.Offset(i, 1) = M_ax M_ax = 0 End If i = i + 1 Wend End Sub
Bookmarks