Hi all,
I have two Arrays, each set As String. The first, Array1, contains a list of names as specified in the VBA code itself.
The second, Array2, is a variable length list of names imported from an .accdb file and dumped onto the 'NameDump' worksheet. This is the method I have used to set the array (which works as far as I can tell).
What I would like to do is compare the names of Array1 with those found in Array2. Each time there is a match, I would like to set a variable (lets call it Var1) as the cell next-door to the match in Column B, which contains a string related to each name. I will then perform some other shenanigans on Var1 (I've got that bit of code sorted), before continuing to search for matches.
I've have looked into this a fair bit for the last few hours, just so you beautiful folks at mrexcel know I have at least tried (I know effort is appreciated before questions are asked), and I believe the solution will combine For Each, 'i', Match and Offset - but I'm afraid the combination, and solution to my task, is a bit beyond my current understanding of VBA unfrotunately.
Thank you all in advance for any help
I have two Arrays, each set As String. The first, Array1, contains a list of names as specified in the VBA code itself.
VBA Code:
Array1 = Array ("Dave", "Ethel", "Danger Mouse", "King Erebus III, Destroyer of Realms")
The second, Array2, is a variable length list of names imported from an .accdb file and dumped onto the 'NameDump' worksheet. This is the method I have used to set the array (which works as far as I can tell).
VBA Code:
Dim LastNameEntry As Long
LastNameEntry = Worksheets("NameDump"),Range("A1").CurrentRegion.Rows.Count
Dim Array2 As String
Array2 = Array("A2:A" & LastNameEntry")
What I would like to do is compare the names of Array1 with those found in Array2. Each time there is a match, I would like to set a variable (lets call it Var1) as the cell next-door to the match in Column B, which contains a string related to each name. I will then perform some other shenanigans on Var1 (I've got that bit of code sorted), before continuing to search for matches.
I've have looked into this a fair bit for the last few hours, just so you beautiful folks at mrexcel know I have at least tried (I know effort is appreciated before questions are asked), and I believe the solution will combine For Each, 'i', Match and Offset - but I'm afraid the combination, and solution to my task, is a bit beyond my current understanding of VBA unfrotunately.
Thank you all in advance for any help