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:
Thanks for your help
\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:
Code:
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 'Original Folder Path
fld = Split(OPath, "\") '
For i = 0 To UBound(fld)
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