Sub test1()
Dim r, i
r = Range("d65536").End(xlUp).Row
For i = 2 To r
Cells(i, 3) = f(Cells(i, 4))
Next i
End Sub
Function f(str)
Dim regex As Object, matchs As Object
Dim i As Integer
Set regex = CreateObject("VBScript.RegExp")
With regex
.Global = False
.Pattern = "[A-Za-z]+\w+"
Set matchs = .Execute(str)
If .test(str) Then
Set matchs = .Execute(str)
f = matchs(0)
End If
End With
End Function
Sub test1()
Dim r, i
r = Range("d65536").End(xlUp).Row
For i = 2 To r
Cells(i, 3) = f(Cells(i, 4))
Next i
End Sub
Function f(str)
Dim regex As Object, matchs As Object
Dim i As Integer
Set regex = CreateObject("VBScript.RegExp")
With regex
.Global = False
.Pattern = "[A-Za-z]+\w+"
Set matchs = .Execute(str)
If .test(str) Then
Set matchs = .Execute(str)
f = matchs(0)
End If
End With
End Function