Hey there
I'm using VBA code to lookup a code and return the description of it from another worksheet.
It works perfectly when I copy the code from the other sheet into the cell used to lookup, or when I enter a code containing a letter. But as soon as I enter the code manually and the code consists of numbers only, it doesn't find the match on the other sheet.
I have added watches and converted the codes to string and even though both would be strings, the code doesn't identify them as being similar.
Watch : : Item_codesheet : "700030 " : Variant/String : Module1.Item_to_Description
Watch : : Item_insert : "700030" : Variant/String : Module1.Item_to_Description
Any idea why this is happening?
I'm using VBA code to lookup a code and return the description of it from another worksheet.
It works perfectly when I copy the code from the other sheet into the cell used to lookup, or when I enter a code containing a letter. But as soon as I enter the code manually and the code consists of numbers only, it doesn't find the match on the other sheet.
Code:
If Item_insert = Item_codesheet Then
voucherSheet.Range(address).Offset(0, 1).Value = itemcodesSheet.Range("D" & j).Offset(0, 1).Value
End If
I have added watches and converted the codes to string and even though both would be strings, the code doesn't identify them as being similar.
Watch : : Item_codesheet : "700030 " : Variant/String : Module1.Item_to_Description
Watch : : Item_insert : "700030" : Variant/String : Module1.Item_to_Description
Any idea why this is happening?
Last edited: