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 I need a macro to delete unwanted data

Put a b in the first 3 cells and run it. You will find it skips rows. You
need to loop from the highest numbered row to the lowest numbered row.


For i = 3 To 1 Step -1
If Cells(i, "A") = "b" Then Cells(i, "A").EntireRow.Delete
Next

--
Regards,
Tom Ogilvy

"Toppers" wrote in message
...
Hi,
Something along these lines:

For i = 1 To 3
If Cells(i, "A") = "b" Then Cells(i, "A").EntireRow.Delete
Next


HTH

"Jason" wrote:

Hi all,

I need to design a macro in Excel that will delete all unwanted data.
For example: I have fields a,b,c,d. In field c my data is either
x,y,z. If data is y then I want to delete the entire row.

Thanks