Deleting a row

Closed
Report
Posts
1
Registration date
Wednesday July 3, 2013
Status
Member
Last seen
July 3, 2013
-
Posts
2847
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
January 13, 2022
-
I have an Excel file with rows from 2 to 988. There are two columns B titled Customer and C titled Main Email. I need a macro that will search column C for two things. 1) if column C row ___ has no data in that cell to delete the entire row, and 2) if Column C row ___ has marketplace in that cell to delete the entire row.

Thanks

1 reply

Posts
2847
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
January 13, 2022
491
Hi Martinezbm,

Here you go:
Sub DeleteRows()
Dim x As Integer

For x = 988 To 2 Step -1
    If Range("C" & x).Value = vbNullString Or _
    Range("C" & x).Value = "marketplace" Then _
    Rows(x).Delete
Next x

End Sub

Best regards,
Trowa
0