Delete rows which not equal to criteria.

googleelgoog

New Member
Joined
Mar 2, 2004
Messages
9
Hi all,

Is there short way (without loop) to delete rows which its cetain cells not equal to criteria?


Example
A
_______
AAA
AAA
BBB
CCCC
AAA


Delete all except "AAA"

Thanks in advance.
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Hello,

Can you not sort the column and then delete all non AAA rows.

ALternatively,

Select all the cells ensuring a cell with AAA, select GOTO-->SPECIAL and select COLUMN DIFFERENCES, al non AAA cells will be highlighted, select EDIT-->DELETE and check ENTIRE ROW.

Alternativelty there is a VB way, but you didn't want this.
 
Upvote 0
Hello,

Here is the VB Code

Code:
Sub LEAVE_AAA()
For MY_ROWS = Range("A65536").End(xlUp).Row To 1 Step -1
    If Range("A" & MY_ROWS).Value <> "AAA" Then
        Rows(MY_ROWS).Delete
    End If
Next MY_ROWS
End Sub

Are you OK with creating macros?
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,692
Members
448,979
Latest member
DET4492

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top