VBA es el camino a seguir en este escenario. He reunido un código que puede usar para buscar direcciones de correo electrónico en una hoja (precedido por "correo electrónico:"). Devolverá las direcciones de correo electrónico en una columna en una nueva hoja llamada "Lista de correo electrónico". Simplemente pegue lo siguiente en un módulo y ejecute los Sub GatherEmails.
Option Explicit
Sub GatherEmails()
Dim s1 As Worksheet, r1 As Range, s2 As Worksheet, r2 As Range
Dim tmp() As Variant, rws As Long, cols As Long, tmpStr As String
Dim tmpOut As String, output() As String
Set s1 = ActiveSheet
Set r1 = s1.UsedRange
'Load all data from sheet into array for fast processing.
tmp = r1.Value
'Loops through all values, extracts email addresses, and stores them in one space-delimited string.
For rws = 1 To UBound(tmp, 1)
For cols = 1 To UBound(tmp, 2)
If tmp(rws, cols) <> "" Then
tmpStr = MatchEmails(CStr(tmp(rws, cols)))
If tmpStr <> "" Then
tmpOut = tmpOut & tmpStr & " "
End If
End If
Next cols
Next rws
Erase tmp
'Remove trailing space from string
tmpOut = Left(tmpOut, Len(tmpOut) - 1)
'Store email addresses in an array.
output = Split(tmpOut, " ")
'Create new sheet and print array of email addresses there.
Set s2 = Sheets.Add
s2.Name = "Email List"
Set r2 = s2.Range("A1").Resize(UBound(output) + 1, 1)
r2.Value = Application.WorksheetFunction.Transpose(output)
Erase output
End Sub
Private Function MatchEmails(searchstring As String) As String
'Uses regex pattern to find email addresses preceded by "email:" and strips away "email:".
'Returns all matches in one space-delimited string.
Dim objRegex As Object, matches As Variant, i As Long
Set objRegex = CreateObject("vbscript.regexp")
With objRegex
.Global = True
.Pattern = "email:([^ ]*)"
Set matches = .Execute(searchstring)
If matches.Count > 0 Then
For i = 1 To matches.Count
MatchEmails = MatchEmails & .Replace(matches(i - 1).Value, "$1") & " "
Next i
MatchEmails = Left(MatchEmails, Len(MatchEmails) - 1)
Else
MatchEmails = ""
End If
End With
End Function
Nota: Deberá agregar una referencia para usar la sintaxis de expresión regular en la función. En el editor de VBA, vaya a 'Herramientas' & gt; & gt; 'Referencias ...', luego marque la casilla junto a 'Microsoft VBScript Regular Expressions 5.5'.