Livin404
Well-known Member
- Joined
- Jan 7, 2019
- Messages
- 743
- Office Version
- 365
- 2019
- Platform
- Windows
Good afternoon I'm currently use the code below and it does work perfectly; however, you can see I have a number "92" I constantly have to change since the quantity will never be the same. The second code you see is the approach I'm trying to take with this. There are no error codes, but nothing is happening either. The column with the three letter code I'm looking for is Column C on the sheet "72 Hr" the codes on found on the worksheet labeled "3 LTR" for which there are two columns A:B that has a name range of "IATA". I'm reasonably confident I'm nearly there, but need a little tug across the finish line on this one. Thank you so much,
VBA Code:
Private Sub VLOOK_UP()
For i = 1 To 92
Worksheets("72 Hr").Cells(i, 5).Value = Application.WorksheetFunction.VLookup(Worksheets("72 Hr").Cells(i, 3).Value, Worksheets("3 LTR").Range("A:B"), 2, 1)
Next
End Sub
VBA Code:
Private Sub VLOOK_UP()
Dim rng As Range
With Worksheets("72 Hr")
Set rng = .Range(.Range("C1"), .Cells(Rows.Count, 2).End(xlUp))
End With
With Worksheets("3 LTR")
.Range("A2").Offset(x, 0) = _
Application.WorksheetFunction.VLookup(.Range("A:B").Offset(x, 0), rng, 2, False)
End With
End Sub