Thread: Code
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Code

Sub InsertRowBeforeNo()
Dim rng as Range, i as Long
set rng = cells(rows.count,3).End(xlup)
for i = rng.row to 2 step -1
if Ucase(cells(rng.row,3).Value) = "NO" then
cells(rng.row,3).EntireRow.Insert
end if
Next
End Sub

--
Regards,
Tom Ogilvy


"Dan" wrote in message
...
Hi:

I have 3 col:

1 1 OK
2 2 OK
3 4 NO

I would like please, a code that searches for "no" and
when is found highlight the row and insert another row
above??

Any help is appreciated.

Thsnk,

Dan