Hi,
I have two list. I need to check if value from one list is existing in second list. If not existing I should add on the end of the list the value. If exist I should in column B add "YES".
But how to add value to the list if it dosen't exist?
I have two list. I need to check if value from one list is existing in second list. If not existing I should add on the end of the list the value. If exist I should in column B add "YES".
Code:
Function X()
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Set ws1 = ActiveWorkbook.Worksheets("Sheet1")
Set ws2 = ActiveWorkbook.Worksheets("Sheet2")
Dim i, j, x_ws1_rows, x_ws2_rows As Long
ws1.Activate
x_ws1_rows = ws1.Cells(Rows.Count, "A").End(xlUp).Row
x_ws1_rows = x_ws1_rows
ws2.Activate
x_ws2_rows = ws2.Cells(Rows.Count, "A").End(xlUp).Row
x_ws2_rows = x_ws2_rows
'we take first value from new list
For i = 1 To x_ws1_rows
'checking value in mapping list
For j = 1 To x_ws2_rows
If ws1.Range("B" & i).Value = ws2.Range("A" & j).Value Then
ws2.Range("C" & j).Value = "yes"
'maybe exit: For??
End If
Next j
Next i
End Function
But how to add value to the list if it dosen't exist?