Hello,
Hope this make sense. I am stuck up with formula to vlookup for multiple values in multiple columns and retrun results in adjacent cells, like : search each cell value from column A & Column B of data sheet, in Master Sheet, if found, return result value of 5th & 6th column of same row. Loop thru all such cells and return results in Data sheet. OR, is it possible to set rs.field multiple values as string to find, such as: "rs.Fields(6).Value & rs.Fields(5).Value" and serach those value in master sheet and return results in adjacent cells while importing data from closed workbook via ADO and loop thru all rs.field values.
Code:
Code
Do While Not .EOF
For i = 0 To .Fields.Count - 1
TargetCell.Offset(0, i).Value = Trim(.Fields(i).Value)
Next i
TargetCell.Offset(0, i+1).Value = VLookup(rs.Fields(6).text & rs.Fields(5).text _
VLookup(rs.Fields(6).Value, _
Sheet(Master).Range("A:B"),5, False)
and next adjacent Cell = return value of 6th column
Set TargetCell = wKs.Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
.MoveNext
Loop
Display More