我正在寻找一个在Excel文档中使用的公式,该文档将突出显示和/或以某种可视方式指示电子邮件地址条目是否无效。我已查看以下excel email validation formula但是,上述内容仅在输入新数据时有效。
答案 0 :(得分:0)
我同意囚犯,
或者我使用vba在我的工作表中执行此操作。如果单元格中有任何有趣的字符,或者它没有包含正确的文本,则会突出显示该单元格。
很简单,然后根据您的需要进行修改。
'=========================================================================
' Format the cell boarders when the info needs to be corrected or updated
'=========================================================================
Dim ThisSheet As Worksheet
Set ThisSheet = Worksheets("Namelist")
Dim lRow As Long
Dim emailRng As Range
Dim Cell As Range
With ThisSheet
' Flags cells where the Email field contains invalid characters
lRow = Range("G" & Rows.Count).End(xlUp).Row
Set emailRng = ThisSheet.Range("A2:A" & lRow)
For Each Cell In emailRng
If Cell.Value = "," _
Or Cell.Value = " " _
Or Cell.Value = "wd" _
Or Cell.Value = "" _
Or Not Cell.Find("<") Is Nothing _
Or Not Cell.Find(">") Is Nothing _
Or Not Cell.Find(":") Is Nothing _
Or Not Cell.Find(" ") Is Nothing _
Or Cell.Find("@") Is Nothing _
Or Cell.Find(".com") Is Nothing And Cell.Find(".co.za") Is Nothing Then
Cell.Interior.Color = vbRed
Else:
Cell.Interior.ColorIndex = 0
End If
Next