Thread: TRIM function
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Sheeloo[_3_] Sheeloo[_3_] is offline
external usenet poster
 
Posts: 1,805
Default TRIM function

Try this UDF (sorry, may not fit on a postcard :-)
'USAGE enter into any cell as =extractCAPS(A1) if your string is in A1
Function extractCAPS(iStr As String) As String
extractCAPS = ""
Dim c As String
Dim iWord As String
iWord = ""
Dim i As Integer
If Len(iStr) = 0 Then
extractCAPS = ""
Exit Function
End If
For i = 1 To Len(iStr)
c = Mid(iStr, i, 1)
If c < " " Then
iWord = iWord & c
Else
If (iWord = StrConv(iWord, vbUpperCase)) Then
extractCAPS = extractCAPS & iWord
End If
iWord = " "
End If
Next i
If (iWord = StrConv(iWord, vbUpperCase)) Then
extractCAPS = extractCAPS & iWord
End If
End Function
--
If you find this post helpful pl. choose "Yes"...


"JockW" wrote:

Hi
Is it possible to use a function to extract only words in capital letters in
a cell?
So, for instance from "IS IT POSSIBLE to use a function" would return IS IT
POSSIBLE and ignore the rest.

Answers on a postcard please....
--
tia