Maybe these two macros will help.
Sub Test()
Dim CapitalisedWord As Boolean
CapitalisedWord = False
CapitalisedPhrase = False
For N = 1 To Len(Cells(1, 1))
Select Case Asc(Mid(Cells(1, 1), N, 1))
Case 65 To 90
If N = 1 Then
CapitalisedWord = True
CurrentWord = Mid(Cells(1, 1), 1, 1)
ElseIf Asc(Mid(Cells(1, 1), N - 1, 1)) < 65 Or Asc(Mid(Cells(1, 1), N - 1, 1)) > 90 Then
CapitalisedWord = True
CurrentWord = Mid(Cells(1, 1), N, 1)
End If
Case 97 To 122
If CapitalisedWord = True Then
CurrentWord = CurrentWord & Mid(Cells(1, 1), N, 1)
Else
Cells(Rows.Count, 3).End(xlUp).Offset(1, 0) = CurrentWord
CurrentWord = ""
End If
Case Else
Cells(Rows.Count, 3).End(xlUp).Offset(1, 0) = CurrentWord
CurrentWord = ""
CapitalisedWord = False
End Select
Next N
End Sub
Sub Test2()
MyString = Cells(1, 1)
MyString = Application.Substitute(MyString, ",", " ")
MyString = Application.Substitute(MyString, "(", " ")
MyString = Application.Substitute(MyString, ")", " ")
MyString = Application.Substitute(MyString, ".", " ")
For N = 1 To 10
MyString = Application.Substitute(MyString, " ", " ")
MyString = MyString & " xxxxx"
Next N
MyArray = Split(MyString, " ")
CapitalisedPhrase = ""
For N = 0 To UBound(MyArray)
If UCase(Left(MyArray(N), 1)) = Left(MyArray(N), 1) Then
CapitalisedPhrase = CapitalisedPhrase & " " & MyArray(N)
Else
Cells(Rows.Count, 3).End(xlUp).Offset(1, 0) = Trim(CapitalisedPhrase)
CapitalisedPhrase = ""
End If
Next N
End Sub
They give somewhat different results. Each assumes that the text is pasted into cell A1. Answers appear in Range C2 downwards.
Bookmarks