Try a user defined function like the following:
Function Proper2(S As String) As String
Dim N As Long
Dim T As String
T = S
T = UCase(Left(T, 1)) + Mid(T, 2)
N = 0
Do
N = InStr(N + 1, T, Chr(32), vbBinaryCompare)
If N 0 Then
T = Left(T, N) & UCase(Mid(T, N + 1, 1)) & Mid(T, N + 2)
End If
Loop Until N = 0
Proper2 = T
End Function
It will convert S to proper case, capitalizing only the first letter
of S and any character that is preceeded by a space. Thus,
tim mcGraw
will become
Tim McGraw
rather than
Tim Mcgraw
You can call this from a worksheet cell with
=Proper2(A1)
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
On Thu, 29 Jan 2009 07:59:01 -0800, klmiura
wrote:
Does anyone have a Macro that I can use to change the first letter of every
word in an excel cell to Capital?
For example I have cell A1 with the contents of: private hospital
I would like to run the Macro and the cell to say: Private Hospital
Thank you,
Karen