fruits = "apple, banana, watermelon, tangerine"
list_Fruits = Split(stream, ";")
For i = 2 To finalRow_Paste_tab
if ThisWorkbook.Worksheets("Paste").Range("E" & i).Value equal to a value in the list then
do something
end if
Next
Sub jec()
Dim dic, it, ar, j As Long
Set dic = CreateObject("scripting.dictionary")
For Each it In Array("apple", "banana", "watermelon", "tangerine")
dic(it) = Empty
Next
ar = Array("melon", "watermelon", "pineapple", "apple")
For j = 0 To UBound(ar)
If dic.exists(ar(j)) Then
Debug.Print ar(j) & " in list"
Else
Debug.Print ar(j) & " not in list"
End If
Next
End Sub
fruits = "apple, banana, watermelon, tangerine"
For i = 2 To finalRow_Paste_tab
If InStr(fruits, Worksheets("Paste").Range("E" & i)) Then
'do something
End If
Next i
It makes no difference - they can make it as long as the want with as many items in the string as they want.But that is just a sample string There probably is more data
fruits = ",pineapple,banana,watermelon,tangerine,"
For i = 2 To finalRow_Paste_tab
If InStr(fruits, "," & Worksheets("Paste").Range("E" & i) & ",") Then
'do something
MsgBox i
End If
Next i
You may want to tailor your code more to their specific scenario, i.e. you aren't even referencing the cells on their sheet, you are just comparing two lists you have directly in your VBA code.Yes but the dictionary is far more efficiënt on larger datasets.