Sub Search_Range_For_Text()昏暗的单元格作为范围
For Each cell In Range("b1:b100")
If InStr(1, cell.Value, "After Upd") > 0 Then
cell.Offset(0, 0).Value = "TH Value"
MsgBox "verify if there was a check shot"
End If
下一个单元格
结束子
在所需位置添加Exit For
将使您退出for循环。
Sub Search_Range_For_Text()
Dim cell As Range
For Each cell In Range("b1:b100")
If InStr(1, cell.Value, "After Upd") > 0 Then
cell.Offset(0, 0).Value = "TH Value"
MsgBox "verify if there was a check shot"
Exit For
End If
Next cell
End Sub
您也可以使用“直到/执行While循环”代替“ For循环”。>
希望对您有帮助。