none
Searching for partial text in vba RRS feed

  • Question

  • I have the below VBA code that searches for the exact text in a colum:

     Filter3InSummary = Array(Array("AE43", "TT", "I:I", "<>Duplicate TT", _
                                                 "G:G", "<>Not Tested", _
                                                 "U:U", "Item"))
        For Each test In Filter3InSummary
        With Worksheets(test(1))
            Range(test(0)) = wf.CountIfs(.Range(test(2)), test(3), _
                                         .Range(test(4)), test(5), _
                                         .Range(test(6)), test(7))

    But this code will exactly search for that word.

    If the text has for example: "Item tested" instead of "Item", there will be no result show.

    How can I modify this to taken in partial words from a cell into consideration?

    Monday, January 9, 2017 12:00 PM

Answers

All replies

  • I think the only way to do it is you need to fix the spreadsheet before you perform test.  You can loop through column and if it contains Item then make it Item.  Use Instr command.

    • Edited by mogulman52 Monday, January 9, 2017 1:12 PM
    Monday, January 9, 2017 1:11 PM
  • That would be more complex for me..Is there any wildcard characters that I can use in VBA?
    Monday, January 9, 2017 1:28 PM
  • Got the answer. "*" does the job
    Monday, January 9, 2017 3:15 PM