I'm trying to get a field in a text file output to update referencing Array (Temp) where column B checks column D and updates as data in column D.
STEPS:
Created the Array (temp) then used Index Match to set column B to column D to populate column H
Range("H2:H17") = "=INDEX(D2:D17,MATCH(B2:B17,B2:B17,0))"
CODE TO PULL COLUMN B BASED ON COLUMN D in Array:
Dim DoEdit As String
Dim Source As String
Sheets("Temp").Select
Source = Range("B2").Value
EditLine = Line
DoEdit = Range("H2")
If DoEdit <> "" Then
Target = Application.WorksheetFunction.VLookup(Source,Range("B2:D20"), 3, False)
End If
This code only work 1 for 1 where the source is defined so the output is "test1" since source is set to B2.
The correct output should go through the list in column B: 96NW2702 is test1 0039430695 is test3 23832026 is test11
QUESTION:
How can I get "Target" to update a text file by doing a VLookup, checking column B versus column D ..basically do what the index & match is doing above, going through the list in column B in a loop? I tried setting the source as a range for column B, but getting "object required" and cannot get through the rest of the code.
Dim DoEdit As String
Dim Source As String
Sheets("Temp").Select
Set Source = ThisWorkbook.Worksheets("temp").Range("B2:B20")
EditLine = Line
DoEdit = Range("H2")
If DoEdit <> "" Then
Target = Application.WorksheetFunction.VLookup(Source,Range("B2:D20"), 3, False)
End If
Thanks for any help!