I have empty rows in my worksheet and I want to delete them in such a way that if row above is or below is not empty, I do not want to delete them. I don't want to delete them so there are at least 1 empty row below the previous filled rows.
I know how to delete empty rows in a sheet:
Worksheets("Sheet1").Columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
But I am not sure how to change this to implement that. Need some guidance on how to do this.
My code looks like this now:
For Each ws In Workbooks(newwb).Sheets
    If (ws.Name <> "Sheet1") And (ws.Name <> "Sheet2") And (ws.Name <> "Sheet3") Then
        'ws.Columns("A:A").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
        lRow = ws.Range("A" & Rows.Count).End(xlUp).Row
        For i = 1 To lRow
            If Application.WorksheetFunction.CountA(ws.Range("A" & i & ":O" & i + 2)) = 0 Then
                If IsEmpty(rngBlanks) Then
                    Set rngBlanks = ws.Rows(i + 1)
                Else
                    Set rngBlanks = Union(rngBlanks, ws.Rows(i + 1))
                End If
            End If
        Next i
        rngBlanks.EntireRow.Delete
        Set rngBlanks = Nothing
    Else
        ws.Delete
    End If
Next
When doing, it gives me a Run-Time error '5': Invalid Procedure Call or Argument at the line Set rngBlanks = Union(rngBlanks, ws.Rows(i+1))
