Hello,
Please see the attached spreadsheet. I am trying to get a code to delete all rows that have the word "PDM" alone.
Thanks
Hello,
Please see the attached spreadsheet. I am trying to get a code to delete all rows that have the word "PDM" alone.
Thanks
BTW, the word is "PDM "
Sub PDM_DeleteLoneRows() 'For help see: http://www.vbaexpress.com/forum/showthread.php?53069-Delete-Rows-that-meet-a-Criteria Dim Rw As Long Dim WsF As Object Set WsF = Application.WorksheetFunction Rw = Cells(Rows.Count, "I").Row With Columns("I") Do If Replace(.Cells(Rw).Value, " ", "") = "PDM" And WsF.CountA(Rows(Rw)) = 1 Then Rows(Rw).Delete Rw = Rw - 1 Loop While Rw > 0 End With End Sub
I expect the student to do their homework and find all the errrors I leeve in.
Please take the time to read the Forum FAQ