I can not get the VLookup function to work when using a named range. I am sure it has something to do with how I am referencing "COA_Range" but cant find a solution that works
I have tried [], ([]), (""), [""],([""])......
(Below is an updated and expanded section of the code)
If Transaction_Type = 1 Then
Debug.Print "Transaction Type :"; Transaction_Type
Range("n10").Value = "Income"
Debug.Print "COA # = "; TransactionInfo.Income_COA_Number.Value
COA_Number = TransactionInfo.Income_COA_Number.Value
Debug.Print COA_Number
Range("n12").Value = TransactionInfo.Income_COA_Number.Value
'thought from STACK OVERFLOW
Debug.Print Range("COA_Range").Address()
COA_1 = Application.WorksheetFunction.VLookup(COA_Number, Range("COA_Range"), 2, False)
Debug.Print COA_1
Range("n13").Value = COA_1
TransactionInfo.Income_COA_Number? You can also refer named range byThisworkbook.Names("COA_Range").RefersToRange.Debug.Print Range("COA_Range").Address()to make sure the range is found.TransactionInfo.Income_COA_Number.Valueis a true number or text-that-looks-like-a-number. I suspect it is the latter and the values in column B ofRange("COA_Range")are true numbers. VLOOKUP cannot find text-that-looks-like-a-number within a column of true numebers. Convert withCLng(TransactionInfo.Income_COA_Number.Value2)to get a true number. Of course, ifCOA_Numberhad been declared as a long instead of not-at-all or a variant then this would have been immediately obvious.