Need help in my codes

Jolenelity

New Member
Joined
Jun 3, 2013
Messages
6
Hi all, I'm currently doing a set of macro codes which has quite a lot of same data starting with "FH" and "FB". Just wondering if there is any ways where I can just filtered out by "FH" and "FB" without typing the whole data out into my codes (in red) as shown below.

Please advice. :) Thank you.

ActiveSheet.Range("$A$1:$AH$995").AutoFilter Field:=21, Criteria1:=Array( _
"FHAP1", "FHAP2", "FHAP3", "FHAP4", "FHAP5", "FHLAP5"), Operator:=xlFilterValues
Cells.Select
Range("F1").Activate
Selection.Copy
Sheets.Add After:=Sheets(Sheets.Count)
Sheets("Sheet1").Name = "Residential Raw"
ActiveSheet.Paste

Sheets("Raw").Select
Application.CutCopyMode = False
ActiveSheet.Range("$A$1:$AH$995").AutoFilter Field:=21, Criteria1:=Array( _
"FBAP1", "FBAP2", "FBAP3", "FBAP4", "FBAP5"), Operator:=xlFilterValues
 
Try
Code:
    ActiveSheet.Range("$A$1:$AH$995").AutoFilter Field:=21, Criteria1:="=FH*", _
        Operator:=xlOr, Criteria2:="FB*"
Regards,
 
Upvote 0

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