#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 32
Default TRIM function

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
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,124
Default TRIM function

One way
Sub getcaplettersfromstring()
ac = ActiveCell
For i = 1 To Len(ac)
If Mid(ac, i, 1) = UCase(Mid(ac, i, 1)) Then
'MsgBox Mid(Ac, i, 1)
ms = ms & Mid(ac, i, 1)
End If
Next i
MsgBox ms
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"JockW" wrote in message
...
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


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,718
Default TRIM function

Download and install the free add-in Morefunc.xll from:
http://xcell05.free.fr/

=REGEX.SUBSTITUTE(A1,"[a-z,0-9]","")


"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

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
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

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 32
Default TRIM function

Thanks Don, works fine but I would like the resilts in a seperate cell. I
didn't state that so my fault.
--
tia


"Don Guillett" wrote:

One way
Sub getcaplettersfromstring()
ac = ActiveCell
For i = 1 To Len(ac)
If Mid(ac, i, 1) = UCase(Mid(ac, i, 1)) Then
'MsgBox Mid(Ac, i, 1)
ms = ms & Mid(ac, i, 1)
End If
Next i
MsgBox ms
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"JockW" wrote in message
...
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





  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 32
Default TRIM function

I can't get this to work! Probably me. Where do I put it?
--
tia


"Sheeloo" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
TRIM FUNCTION...how to? Shayra Excel Worksheet Functions 3 March 10th 08 06:39 PM
Trim Function Saxman[_2_] Excel Discussion (Misc queries) 7 August 2nd 07 01:20 AM
TRIM function fitou_learn[_2_] New Users to Excel 2 June 12th 07 11:06 AM
Trim Function Matt M HMS Excel Worksheet Functions 5 November 21st 05 10:46 PM
Need help with TRIM function Phil Excel Worksheet Functions 9 October 21st 05 08:02 PM


All times are GMT +1. The time now is 06:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"