Text filter that contains a text

LeanneBG

Board Regular
Joined
Jun 20, 2016
Messages
157
Hi Experts! I know it sounds so simple.. but i cannot seem to find the answers.. I have below code that used to filter the exact "SELECTED_PRCS_PC_FLN", however, i found out that sometimes the data shows not only "SELECTED_PRCS_PC_FLN" but also this :SELECTED_PC_FLN". Is there a way to just change it to filter something that contains "PC_FLN" instead of the specific "SELECTED_PRCS_PC_FLN"? So that it can capture even those that are tagged as "SELECTED_PC_FLN" and others that have "PC_FLN" in its name.. Thanks in advance!

Code:
ActiveSheet.Range("$A$1:$L$1000").AutoFilter Field:=6, Criteria1:= _
        "SELECTED_PRCS_PC_FLN"
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Ok, try this one

Code:
Sub MM1()
Dim lr As Long, n As Long
Sheets("SRPT").Select
lr = Range("A" & Rows.Count).End(xlUp).Row
    With Range("F1:F" & lr)
        .Replace "SELECTED_PC_FLN", "SELECTED_PRCS_PC_FLN"
        .Replace "SELECTED_MONTH_START", "SELECTED_PRCS_MONTH_START"
        .Replace "SELECTED_SCN_TGT", "SELECTED_PRCS_SCN_TGT"
    End With
    With Range("Q1:Q" & lr)
        .Replace "SELECTED_PC_FLN", "SELECTED_PRCS_PC_FLN"
        .Replace "SELECTED_MONTH_START", "SELECTED_PRCS_MONTH_START"
        .Replace "SELECTED_SCN_TGT", "SELECTED_PRCS_SCN_TGT"
    End With
End Sub
 
Upvote 0
Ok, try this one

Code:
Sub MM1()
Dim lr As Long, n As Long
Sheets("SRPT").Select
lr = Range("A" & Rows.Count).End(xlUp).Row
    With Range("F1:F" & lr)
        .Replace "SELECTED_PC_FLN", "SELECTED_PRCS_PC_FLN"
        .Replace "SELECTED_MONTH_START", "SELECTED_PRCS_MONTH_START"
        .Replace "SELECTED_SCN_TGT", "SELECTED_PRCS_SCN_TGT"
    End With
    With Range("Q1:Q" & lr)
        .Replace "SELECTED_PC_FLN", "SELECTED_PRCS_PC_FLN"
        .Replace "SELECTED_MONTH_START", "SELECTED_PRCS_MONTH_START"
        .Replace "SELECTED_SCN_TGT", "SELECTED_PRCS_SCN_TGT"
    End With
End Sub

Hi @Michael M, I just did some tweaks but it is now working :) Thank you for all your help. :D
 
Upvote 0

Forum statistics

Threads
1,215,019
Messages
6,122,707
Members
449,093
Latest member
Mnur

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