第一种方法,使用For循环:
For Each cell In Range("I1:I1000")
i = InStr(cell.Value, "1050")
If i > 0 Then
bExist = True
Exit For
End If
i = 0
Next
第二种方法,使用Do循环:
''' Another way to realize
i = 1
Do Until (i > Range("I1:I1000").Cells.Count)
If InStr(Range("I1:I1000").Cells(i).Value, "1050") > 0 Then
bExist = True
Exit Do
End If
i = i + 1
Loop