Filtering Cells using VBA

zaska

Well-known Member
Joined
Oct 24, 2010
Messages
1,046
Hi all,

Code:
   Range("A1:H1").AutoFilter Field:=8, Criteria1:="=BE", Operator:=xlOr, _
        Criteria2:="=EQ"
    Range("A2").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Copy
    ActiveWindow.ScrollRow = 1
    Range("I1").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Range("A1:H1").Select
    Selection.AutoFilter
    Columns("A:H").Delete
    Range("B3").Select

I am using the above code to filter "BE" and "EQ" . I would like senior members to suggest alternative if any for the above code. i.e filtering only "BE" and "EQ" and deleting the remaining

What i tried in the above code is to Filter " BE " and " EQ " paste the filtered columns next to the original data and delete the original data.

Thanks
 
Finally it worked and Amazing.

Thank you for the kind support.

Have a nice day

Regards,

Zaska
 
Upvote 0

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Forum statistics

Threads
1,224,518
Messages
6,179,258
Members
452,901
Latest member
LisaGo

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