I have three Sheets, Sh1 , Sh2, Sh3. Sh3 is my result sheet.
I have copied Column N from Sh1 to Sh3 in column E.
I consider column E of sheet3, then I compare the Column A of sheet2, If they match, then I will copy the result in sheet3 in column F.
I am able to find the matching columns, but, I have few Special cases, which I am not able to sort out.
I have explained them in the Image .
[![The Image Shows an example of how the ID Looks in column E of sht3][1]][1]
![Here i have shown both structure of ID. The first row id is the same, and has no Problem ist finding the match. In the second row, there is an 0 less in my sheet2, and the code Fails to Display that, in row 3, the Id has an 0 extra in sheet2. in row 4, i have an id with other id, but in sheet2, i have the same id, with 0 extra, same in row 5 as well, The ID are generally 11 to 13 Digit Long. ]1
Could someone suggest how I could overcome this issue. Below is the code, I am using to copy the values from one sheet to another and looking for the values in another sheet.
Sub lookup()
Dim lLastrow As Long
Dim rng As Range
Dim i As Long
ThisWorkbook.Sheets("S").Select
lLastrow = ActiveSheet.Cells(ActiveSheet.Rows.Count, 1).End(xlUp).Row
Range("P5:P" & lLastrow).Copy Destination:=Sheets("Result_APQP").Range("E5")
Range("G5:G" & lLastrow).Copy Destination:=Sheets("Result_APQP").Range("H5")
Sheets("Result").Select
For i = 5 To lLastrow
Set rng = Sheets("P").UsedRange.Find(Cells(i, 5).Value & "*", LookAt:=xlWhole)
'If it is found put its value on the destination sheet
If Not rng Is Nothing Then
Cells(i, 6).Value = rng.Value
End If
Next i
End Sub