Adapt code to search partial text, case find put result column AT

marreco

Well-known Member
Joined
Jan 1, 2011
Messages
609
Office Version
  1. 2010
Platform
  1. Windows
Hi.

Code:
Sub myFilter2()'Coded by RickXL
'https://www.mrexcel.com/forum/excel-questions/917998-wild-card-unable-use-autofilter-array.html
    Dim dic     As Object
    Dim eleData As Variant
    Dim eleCrit As Variant
    Dim arrData As Variant
    Dim vTst    As Variant


    Set dic = CreateObject("Scripting.Dictionary")
    vTst = Array("*Cancel*", "*cancel*")
    
    With ActiveSheet
        .AutoFilterMode = False
        arrData = .Range("E2:E" & .Cells(.Rows.Count, "E").End(xlUp).Row)
        For Each eleCrit In vTst
            For Each eleData In arrData
                If eleData Like eleCrit Then dic(eleData) = vbNullString
            Next
        Next
        'If value each cell in coluna E has a text like this("*Cancel*", "*cancel*") then
        'Insert letter w into each cell in column AT


        'I try this
        .Offset(, 41).Value = dic(eleData.Value)
    End With
    
End Sub
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
If you just want to put a "w" into another cell, try
Code:
Sub marreco()
   Dim Cl As Range
   For Each Cl In Range("E2", Range("E" & Rows.Count).End(xlUp))
      If InStr(1, Cl.Value, "cancel", 1) Then Cl.Offset(, 41) = "w"
   Next Cl
End Sub
 
Upvote 0
Hi Fluff

Work greate!!

Thank you!!
 
Last edited:
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,213,534
Messages
6,114,184
Members
448,554
Latest member
Gleisner2

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