'Dynamic vlookup vba code did not populate figures
Please help to advise where did it went wrong. Would like to create a vba vlookup for a different workbook
Sub Executelookup1()
Dim wb As Workbook
Dim rng As Range
Workbooks.Open ("V:\Finance\Systems-Risk-ERM\OrderToCash\C2C\Corp Credit Control\3. Monthly Combined Aging\2022\Apr22\Top Segments & Top All _Apr22.xlsx")
Set ws = Sheet3
Set wb = ActiveWorkbook
ThisWorkbook.Activate
Set rng = ws.Range("K2", ws.Cells(ws.Rows.Count, "K").End(xlUp))
Dim i As Integer
For i = 2 To rng
'On Error Resume Next
Range("K" & i).Value = WorksheetFunction.VLookup(Range("F" & i).Value, wb.Sheets("TopSegments").Range("F:J"), 5, 0)
Next i
End Sub
I would like to have the end product to look like the picture displayed below.

Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
