I'm trying to tweak some code I found that will add/delete rows on a seperate sheet when I add/delete rows in my summary sheet.

Here's what I'm trying to use:

 Sub AddDelete()
Dim rX As Range, rY As Range, i&
With Sheets("Financial Statements Summary")
    Set rX = .Range("Summary_Format", .Cells(Rows.Count, 4).End(xlUp))
End With
With Sheets("Company1")
    Set rY = .Range("Company1_Format", .Cells(264, Columns.Count).End(xlToLeft))
End With

For i = 1 To rX.Count
    If rX(i) <> rY(i) Then
        If rX(i) <> rY(i + 1) Then
            rY(i).EntireRow.Insert
            rY(i).Value = rX(i).Value
        Else
            rY(i).EntireRow.Delete
        End If
    End If
Next
End Sub

Both Summary_Format and Company1_Format are the same # of rows and columns. They are financial statements. I'm pretty new to code and any help is appreciated.