Turn the logic around, I expect this to work for you:
bFound = False
While Sheets("Data").Cells(iRow, 1) <> "" And bFound = False
If Sheets("Data").Cells(iRow, 11) = Sheets("Data2").Cells(iRow, 1) Then
bFound = True
End If
iRow = iRow + 1
Wend
Explanation:
While Sheets("Data").Cells(iRow, 1) <> "" And bFound = False
allows only when we still have data to process. And we still have not changed bFound, which has an initial meaning False.
- While VBS:
Do While Sheets("Data").Cells(iRow, 1) <> ""
If Sheets("Data").Cells(iRow, 11) = Sheets("Data2").Cells(iRow, 1) Then Exit Do
iRow = iRow + 1
Loop