Is there any fucntion to pick out capital letters in a word. I enter
miCRosoft in a cell. I want to CR in the next cell. Can it be applied to a
column
You can write a User Defined Function (UDF) to do this.
To enter this function:
<alt-F11> opens the VB Editor
Ensure your project is highlighted in the Project Explorer window, then
Insert/Module and paste the code below into the window that opens.
To use the UDF, enter the function
=Caps(cell_ref)
into some cell. e.g. =Caps(A1)
===============================================
Option Explicit
Function Caps(str As String) As String
Dim oRegex As Object
Dim mcMatchCollection As Object
Const sPattern As String = "[A-Z]"
Dim i As Long
Set oRegex = CreateObject("VBScript.Regexp")
oRegex.Global = True
oRegex.ignorecase = False
oRegex.Pattern = sPattern
If oRegex.test(str) = True Then
Set mcMatchCollection = oRegex.Execute(str)
End If
For i = 0 To mcMatchCollection.Count - 1
Caps = Caps & mcMatchCollection(i)
Next i
End Function
=====================================
--ron