jonny
02-07-2019, 04:37 AM
Guys,
Need to extract all the letters within the string , separated by comma.
Now the code extracts first letters only.
Please your help with modifying an user defined function:
Function ExtractLetter(str As String)
Dim TDCode As String
Dim result As String
On Error GoTo ErrHandler:
With CreateObject("vbscript.regexp")
.Pattern = "[A-Z]+"
ExtractLetter = .Execute(str)(2)
End With
Exit Function
ErrHandler:
End Function
Input: HKJ234CBV546LL
Output (is): HKJ
Output (ought): HKJ,CBV,LL
Need to extract all the letters within the string , separated by comma.
Now the code extracts first letters only.
Please your help with modifying an user defined function:
Function ExtractLetter(str As String)
Dim TDCode As String
Dim result As String
On Error GoTo ErrHandler:
With CreateObject("vbscript.regexp")
.Pattern = "[A-Z]+"
ExtractLetter = .Execute(str)(2)
End With
Exit Function
ErrHandler:
End Function
Input: HKJ234CBV546LL
Output (is): HKJ
Output (ought): HKJ,CBV,LL