• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Formula to delete empty rows with subtotals retrieved from interface

RAM72

Member
Hi All

Need formula to delete empty rows with subtotals where applicable retrieved from another interface database

See attached file.

Thanks for help
 

Attachments

Hi Ram,

Use below code in a macro to get all the subtotal rows deleted.

Code:
Sub deleterow()

Dim lr As Long

lr = Sheets("Sheet1").Cells(Rows.Count, 7).End(xlUp).Row

For i = lr To 2 Step -1
    If Cells(i, 7) <> "" Then
        Range("G" & i).EntireRow.Delete
    End If
Next i

   
End Sub

Regards,
 
Use this modify code & ignore the earlier one.

Code:
Sub deleterow()

Dim lr As Long

lr = Sheets("Sheet1").Cells(Rows.Count, 7).End(xlUp).Row

For i = lr To 2 Step -1
    If Cells(i, 7) <> "" Or Cells(i, 2) = "" Then
        Range("G" & i).EntireRow.Delete
    End If
Next i

   
End Sub

Regards,
 
Back
Top