Pages

Sunday, March 11, 2012

extract 1 word in cell for macro vba

http://www.teachexcel.com/free-excel-macros/m-138,udf-get-first-word-cell-excel-free-macro.html
Function GETFIRSTWORD(Text As String, Optional Separator As Variant)

Dim firstword As String

If IsMissing(Separator) Then
Separator = " "
End If
firstword = Left(Text, InStr(1, Text, Separator, vbTextCompare))
GETFIRSTWORD = Replace(firstword, Separator, "")

End Function

0 comments:

 

site weekly hits