can someone explain what the below macro does

  • Thread starter Thread starter aneurin
  • Start date Start date
A

aneurin

hi i found the below code that seaches col b for any cell that
contains the word verifiers and deletes the enrire row if found
but can someone explain how it does it
i understand most of it but i cant get my head round thr step -1 part

cheers


Sub del_row()
Dim rw As Integer
Dim Word As String
Word = "Verifiers"

For rw = 2000 To 2 Step -1
If InStr(2, ActiveSheet.Cells(rw, 2).Value, Word, vbTextCompare)
Then Cells(rw, 2).EntireRow.Delete
Next rw
End Sub
 
Step -1 just means to increment the counter by -1. So here it means start
the loop with row 2000 and count backwards (row 1999, 1998 etc) until row 2.
For more, Search VBA help for explanation of for next loops.

Bob L.
 
Back
Top