Retrieve Mail IDs
Sub Mail_Ids()
Range(Range("B2"), Range("B2").End(xlDown)).Rows.Select
Selection.Clear
Dim L
L = Len(Range("D2") & Range("E2"))
MsgBox "Hi you are capturing " & Range("D2") & " Maild IDs"
Dim i As Integer
'It denotes maximum number of rows in column A
Max = Range("A2").End(xlDown).Row
in column B from 2nd row
Dim j As Integer
j = 2
For i = 2 To Max
If Mid(Right(Range("A" & i), L), 1) = Range("D2") & Range("E2").Value Then
Range("B" & j).Value = Range("A" & i).Value
j = j + 1
End If
Next
End Sub