Deleting a row

Closed
martinezbm Posts 1 Registration date Wednesday July 3, 2013 Status Member Last seen July 3, 2013 - Jul 3, 2013 at 06:03 PM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Jul 4, 2013 at 11:22 AM
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 response

TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 555
Jul 4, 2013 at 11:22 AM
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