can someone explain what the below macro does

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
 
B

Bob L.

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top