Function CatTen(str As String) As String Dim mlen As Long Dim i As Long mlen = Len(str) For i = mlen To 1 Step -1 If Mid(str, i, 1) = " " Then Exit For End If Next If i <> 0 Then CatTen = Trim(Mid(str, i + 1, mlen - i)) Else CatTen = Trim(str) End If End Function Function CatHo(str As String) As String Dim mlen As Long Dim i As Long mlen = Len(str) For i = 1 To mlen If Mid(str, i, 1) = " " Then Exit For End If Next If i <> 0 Then CatHo = Trim(Mid(str, 1, i - 1)) Else CatHo = Trim(str) End If End Function Function CatHoDem(str As String) As String Dim mlen As Long Dim i, j, k As Long mlen = Len(str) k = 0 For i = mlen To 1 Step -1 If Mid(str, i, 1) = " " Then Exit For End If k = k + 1 Next For j = 1 To mlen If Mid(str, j, 1) = " " Then Exit For End If k = k + 1 Next If i <> 0 Then CatHoDem = Trim(Mid(str, j, mlen - k)) Else CatHoDem = Trim(str) End If End Function
EmoticonEmoticon