So, I have a variable form a textbox that when I try to use it inside the xlookup formula it can’t find the item, even though I’m looking at it. However, if I type the number directly into the formula it works. I’ can’t wrap my head around why is it not working.
LotNum is the name of the text box, it can be numbers and letters.
Public ICN as Variant
ICN = WorksheetFunction.XLookup(LotNum.Value, Sheets(xlRangeFound).Range("H:H"), Sheets(xlRangeFound).Range("U:U"))
However, if I directly type the number I’m looking for in the formula without quotes, it works:
ICN = WorksheetFunction.XLookup(1444825, Sheets(xlRangeFound).Range("H:H"), Sheets(xlRangeFound).Range("U:U"))
Even though the LotNum.Value is the same as 1444825.
ICN should return a specific value which is C380012.
skywolf90 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1