I have a list of email addresses in column A (eg: andre@mailburst.co.za , pete@ vodacom.co.za). Is there a way to ectract say only the addressesending in "@vodacom.co.za"?
Function mail_addresses(str As String, crit As String, delim as String)
Dim cnt As Integer: cnt = (Len(str) - Len(Replace(str, crit, ""))) / Len(crit)
Dim ans As String: ans = ""
Dim i As Integer
Dim pos_1 As Long
Dim chr_i As Long
Select Case cnt
Case 0
ans = ""
Case Else
For i = 1 To cnt
ans = crit & delim & ans
pos_1 = InStr(str, crit)
For chr_i = pos_1 - 1 To 0 Step -1
If Mid(str, chr_i, 1) = delim Then Exit For
ans = Mid(str, chr_i, 1) & ans
Next chr_i
str = Trim(Mid(str, pos_1 + Len(crit), 10000))
Next i
End Select
mail_addresses = ans
End Function
Function Freedive(txt As String, mySearch As String, _
delim As String) As String
Dim e
For Each e In Split(txt, delim)
If e Like "*" & mySearch Then _
Freedive = Freedive & IIf(Freedive<>"",",","") & Trim(e)
Next
End Function
can you elaborate on the following:
-- are the addresses in one long string in one cell in column A or in multiple cells (1 address per cell) ?
-- are there going to be multiple addresses meeting the criteria and if so how are they to be returned (in one long string or one address per cell etc...)
1) Hit Alt + F11jindon ... I'm a bit of a newbie to all this ... how would I enter the code?