+ Reply to Thread
Results 1 to 2 of 2

Find two words in a list

Hybrid View

MDG Find two words in a list 08-22-2009, 09:45 PM
JBeaucaire Re: Find two words in a list 08-23-2009, 12:01 AM
  1. #1
    Registered User
    Join Date
    08-22-2009
    Location
    Houston, TX
    MS-Off Ver
    Excel 2003
    Posts
    1

    Find two words in a list

    Hope someone can help me with my issue. I have two lists of folders, for example:

    \Animal\Brown\Dog\Chihuahua
    \Animal\Brown\Small\Pug
    \Animal\Dogs\Brown\Small\Corgi
    \Animal\Dogs\Black\Poodle
    \Animal\White\Dogs\Bichon_Frise
    \Animal\Dogs\White\Bichon_Frise

    and

    1.0 Dogs\1.1 White\1.1.1 Poodle
    1.0 Dogs\1.1 White\1.1.2 Chihuahua
    1.0 Dogs\1.1 White\1.1.3 Bichon_Frise
    1.0 Dogs\1.2 Brown\1.2.1 Chihuahua
    1.0 Dogs\1.2 Brown\1.2.2 Pug
    1.0 Dogs\1.2 Brown\1.2.3 Corgi
    1.0 Dogs\1.2 Brown\1.2.4 Poodle
    1.0 Dogs\1.3 Black\1.3.1 Poodle

    I need to identify the correct folder in the second list based on the folder path of the first list. The first list is not well organized, but two words in the first list can be used to identify the correct folder in the second list.

    I first used "Split" to get each subfolder name, but I'm not sure how to search every value in the second list to find two matching words. My code so far:
    Sub Testit()
        Dim OPath As String
        Dim NPath As String
        Dim fld As Variant
        Dim x As Integer
        Dim i As Long
        Dim Folder(1 To 10)
        
        For x = 1 To 6
            OPath = Cells(x, 1).Value 'Orginial Folder Path
            fld = Split(OPath, "\") '
            For i = 0 To UBound(fld)
           'MsgBox fld(i) & " - " & i
                Debug.Print fld(i) 'subfolder name
            Next i
        
        '??? how do I find two words that match the folders in the second list ???
        
        Next x
    End Sub
    Thanks for your help

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Find two words in a list

    Cross-posted
    http://www.mrexcel.com/forum/showthread.php?t=411489
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1