Excel: Extract Proper Case words


Hello All, I have been using following code to extract all upper case words in a string but the problem is I can not extract words which are proper. For example This is GOOD Present output: GOOD Desired Output: This GOOD

Function UpperWords(str As Variant) As String
    Dim i As Integer, sTemp As String, StrTmp As String
    For i = 0 To UBound(Split(str, " "))
        StrTmp = Split(str, " ")(i)
        If UCase(StrTmp) = StrTmp Then sTemp = sTemp & " " & StrTmp
    Next i
    UpperWords = Trim(sTemp)
End Function
Can any one please suggest what can be suitable modification in this case? Thanks, Webbug


This question generated 12 answers. To proceed to the answers, click here.

This thread is current as of August 17, 2014.


For more resources for Microsoft Excel