Hello,
I need to perform a vlookup but programmatically by a loop instead of inserting the workbookfunction. For each string in my first range I need to check to see if it exists in a second range (like a Vlookup formula). I have tried with the following code but its not working. I would really like some help with this please.
Code:
Sheets("Weekly Shipped Details").Select
Dim oLooks As Range
Set oLooks = Range("I5:I1000").SpecialCells(xlCellTypeConstants)
'--------------------------------------------------------------------------------------------------------------
' VLOOKUP AGAINST CONTAINER NUMBER TO SEE IF CONTAINER WAS ON LAST WEEKS REPORT. ---------------------------
Sheets("Shipment Report.xls").Select
Dim oCheckCell As Range, oCheckCell2 As Range
Range("I2:I1000").SpecialCells(xlCellTypeConstants).Select
For Each oCheckCell In Selection
For Each oCheckCell2 In oLooks
If oCheckCell2 = oCheckCell.Value Then oCheckCell.Offset(0, 1).Value = oCheckCell.Value Else
oCheckCell.Offset(0, 1).Value = "#N/A"
Next oCheckCell2
Next oCheckCell
Bookmarks