View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Delete row if it does not contain

Dim r as Range
Dim lastRow as Long
Dim i as Long
set r = Activesheet.UsedRange
lastrow = r.rows(r.rows.count).Row
for i = lastrow to 3 Step -1
if Instr(1,cells(i,6),"computers and phones", _
vbTextCompare) = 0 then
rows(i).Delete
end if
Next

--
Regards,
Tom Ogilvy

"GregR" wrote in message
oups.com...
I have a table with many rows. I want to delete all rows that do not
contain "*computers and phones*" in column (6). Rows 1 and 2 are header
rows. How do I proceed? TIA

Greg