我刚刚开始学习VBA,我试图让if和loop函数一起工作.我基本上想要在A列中搜索@,如果有@ then = ok,如果不是="无效".我让它工作一行,但循环它为整个列.请提出建议.PS.请放纵我丑陋的第一个定时器代码.
先谢谢你,克里斯汀
Sub help()
Dim email As String
email = InStr(email, "@")
Do While email = InStr(email, "@")
Cells(email, 1).Value = email
If email = 0 Then
Cells(email, 1).Offset(, 1).Value = "Not valid"
Else
Cells(email, 1).Offset(, 1).Value = "ok"
End If
Loop
End Sub
Run Code Online (Sandbox Code Playgroud)