needhelpplease
New Member
- Joined
- May 20, 2011
- Messages
- 4
I want to delete every row that does not have 28168-59 or 19062-59 in column B, except of course the header.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com
ffice
ffice" /><o
></o
>
<o
></o
>
This worked (another than the header part) before I added an OR with another part#, but now that I have both, it’s deleting everything in the spreadsheet.<o
></o
>
<o
></o
>
Any ideas?<o
></o
>
<o
></o
>
Sub main()<o
></o
>
Dim ws As Worksheet<o
></o
>
<o
></o
>
Set ws = ActiveSheet<o
></o
>
<o
></o
>
For i = ws.Range("B65536").End(xlUp).Row To 1 Step -1<o
></o
>
If ws.Cells(i, 2) <> "28168-59" Or ws.Cells(i, 2) <> "19062-59" Then<o
></o
>
<o
></o
>
ws.Rows(i).Delete<o
></o
>
<o
></o
>
End If<o
></o
>
Next<o
></o
>
<o
></o
>
End Sub<o
></o
>




<o


This worked (another than the header part) before I added an OR with another part#, but now that I have both, it’s deleting everything in the spreadsheet.<o


<o


Any ideas?<o


<o


Sub main()<o


Dim ws As Worksheet<o


<o


Set ws = ActiveSheet<o


<o


For i = ws.Range("B65536").End(xlUp).Row To 1 Step -1<o


If ws.Cells(i, 2) <> "28168-59" Or ws.Cells(i, 2) <> "19062-59" Then<o


<o


ws.Rows(i).Delete<o


<o


End If<o


Next<o


<o


End Sub<o

