Macro:- Deleting rows on condition for selected no of col.

Closed
ShridharSahu Posts 1 Registration date Sunday October 5, 2014 Status Member Last seen October 5, 2014 - Oct 5, 2014 at 06:45 PM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Oct 6, 2014 at 11:32 AM
Hi.

I have an excel for which i require to delete rows if there is "n" found in the row. But i want this row to get deleted for only a particular number of column.

I have attached a screenshot of my requirement. Please guys help me figure out this.
Related:

1 response

TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 555
Oct 6, 2014 at 11:32 AM
Hi ShridharSahu,

Your screen capture is a little too big to fit in a thread. This makes it very hard to read.

You say you want to delete rows which contains a "n", but only for a particular number of columns. Since you didn't specify the range try this example:

Sub RunMe()
For Each cell In Range("A1:F20")
    If cell.Value = "n" Then Range(Cells(cell.Row, "A"), Cells(cell.Row, "F")).Delete
Next cell
End Sub


When a "n" is found in the range A1:F20 then the columns A:F of that particular row will be deleted.

Best regards,
Trowa
0