Thread: Deleting Rows
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett[_4_] Don Guillett[_4_] is offline
external usenet poster
 
Posts: 2,337
Default Deleting Rows

change the cells(i,1) to cells(i,7) for column 7

--
Don Guillett
SalesAid Software

"Don Guillett" wrote in message
...
one way

Sub deletenot()
x = Cells(Rows.Count, 1).End(xlUp).Row
For i = x To 4 Step -1
If Cells(i, 1) < 428 _
And Cells(i, 1) < 491 _
And Cells(i, 1) < 493 _
And Cells(i, 1) < 495 _
And Cells(i, 1) < 496 _
Then Cells(i, 1).EntireRow.Delete
Next
End Sub
--
Don Guillett
SalesAid Software

"KJ Dahl" wrote in message
...
Hi everyone,
I seem to be stuck again with a problem that probably is very easy.
The data in my sheet is spread over 7 Columns and about 200-300 Rows.
I want to loop through column 7 and delete the entire row if the value

is
different to 6 possible values.
So if the value in column 7 is different from for example 428, 491, 492,
493, 495 and 496 then the entire row should be deleted.
I have tried putting these values in an array and do a comparison. That
didn't work out.
Neither did a comparison with 5 OR's.

Hope this is understandable, please let me know if you want to see the

code
I've used.

Thanks for your help

KJ