Excel查找和替换工具

Ric*_*cky 0 excel replace cell

我正在尝试修复excel文件中的一堆电子邮件地址.出于某种原因,在过去,一些导入例程决定切掉一些太长或不知何故的电子邮件地址,删除了最后一封信.这是我们公司的通讯列表.

所以我的列表中有100封电子邮件以.ne或.co或.or而不是.net,.com或.org结尾.

我可以使用Excel的替换实用程序通过使用*.ne的搜索项找到损坏的电子邮件,并选择仅查找完全匹配.

但是,当我指示我想用*.net替换找到的项目时,违规者的实际内容将替换为:*.net而不是电子邮件地址的第一部分.

是否有任何功能或者我可以使用该工具在此方案中查找和替换?

问候; 瑞奇

arm*_*ive 5

我刚刚编写了这个宏,并在以.com,.net和.org结尾的三个不同的电子邮件地址上进行了测试.没有错误检查,此宏假定电子邮件地址位于AZ列中的某个位置.它也可以尝试将"m","t"或"g"附加到与".co"等标准相匹配的其他数据.

这个宏基本上扫描A1和Z30000之间的单元格(正如你提到的那样,你有许多地址)并查找以.co .ne或.or结尾的任何内容.它附加了正确的字母以使地址"完整".我希望这有帮助.

Sub Fix_Email()

Dim i As Integer
Dim rngEmail As Range
Set rngEmail = Range("A1:A30000")

For i = 1 To 30000

   'Checks to see if the last 3 characters of a cell's value end in .co, .ne, or .or

    If Right(rngEmail(i).Value, 3) = ".co" Then
        rngEmail(i).Value = rngEmail(i).Value & "m"

    ElseIf Right(rngEmail(i).Value, 3) = ".ne" Then
        rngEmail(i).Value = rngEmail(i).Value & "t"

    ElseIf Right(rngEmail(i).Value, 3) = ".or" Then
        rngEmail(i).Value = rngEmail(i).Value & "g"

    ElseIf Right(rngEmail(i).Value, 2) = ".c" Then 
        rngEmail(i).Value = rngEmail(i).Value & "om" 

    ElseIf Right(rngEmail(i).Value, 2) = ".n" Then 
        rngEmail(i).Value = rngEmail(i).Value & "et"

    ElseIf Right(rngEmail(i).Value, 2) = ".o" Then
        rngEmail(i).Value = rngEmail(i).Value & "rg"

    End If

Next i

End Sub
Run Code Online (Sandbox Code Playgroud)