Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using find to select and delete rows - loop

Status
Not open for further replies.

t16turbo

Programmer
Mar 22, 2005
315
GB
I have some VBA that will find and select a row where value "G17" exists in column B.

I need to repeat this step until there are no "G17"s left in the sheet.

can anyone tell me how??

thanks in advance..
 
You could loop backwards through the cells in the column, deleting as you find the required value. Or you could do an autofilter, then select visible rows, and do a delete ( this would be the easiest way if you were doing this operation manually ).

Here's the code for looping:
Code:
For iRow=Range("B65536").End(xlUp).Row To 1 Step -1
   If Range("B" & iRow).Value = "G17" Then
      Range("B" & iRow).EntireRow.Delete
   End If
Next


Cheers, Glenn.

Did you hear about the literalist show-jumper? He broke his nose jumping against the clock.
 
the operation will be put in a macro that runs a whole heap of other things!

works perfectly!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top