(Solved) – VBA to replace next lines?

(solved)-–-vba-to-replace-next-lines?

I have this piece of code:

Sub DeleteRowsABove()
    Dim fRg As Range

    Set fRg = Cells.Find(What:="(*", LookAt:=xlWhole)

    If Not fRg Is Nothing Then
        If fRg.Row <> 1 Then
            fRg.Offset(-1).EntireRow.Delete
        Else
            MsgBox "Total Group is in the first row already", vbInformation, ""
        End If
    Else
       MsgBox "Do not find Total Group", vbInformation, ""
    End If

End Sub

It searches for “(” character and erases the row above every row that has “(” in it.
The problem is that it only searches for the first one, the others “(” below are not affected. Maybe I’m missing a loop in it right?

thanks in advance.

Leave a Reply

Your email address will not be published. Required fields are marked *