Public Function ExtractCharacters(inputString As String, validCharacters As String) As String
Dim i As Long
For i = 1 To Len(inputString)
If InStr(validCharacters, Mid$(inputString, i, 1)) > 0 Then
ExtractCharacters = ExtractCharacters & Mid$(inputString, i, 1)
End If
Next i
End Function