Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 34
Default Change first letter of every word to Capital

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


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default Change first letter of every word to Capital

There is a built in function for that.

=Proper(A1)
--
HTH...

Jim Thomlinson


"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


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,316
Default Change first letter of every word to Capital

Insert a helper column to the right of column A and enter the following
formula:

=PROPER(A1)

Copy down to the last row and then select all of column B and copy it with
Ctrl+C.

Click on cell A1 and then right click on Cell A1 and select PASTE SPECIAL,
click the VALUES check box and click OK to replace all the original values
with there proper name format values. Delete column B when done.
--
Kevin Backmann


"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


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 34
Default Change first letter of every word to Capital

I have tried this and it does work...sort of; the problem is that I also have
names and it is not displaying them properly..ie McCarthy is being turned
into Mccarthy

"Kevin B" wrote:

Insert a helper column to the right of column A and enter the following
formula:

=PROPER(A1)

Copy down to the last row and then select all of column B and copy it with
Ctrl+C.

Click on cell A1 and then right click on Cell A1 and select PASTE SPECIAL,
click the VALUES check box and click OK to replace all the original values
with there proper name format values. Delete column B when done.
--
Kevin Backmann


"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


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 34
Default Change first letter of every word to Capital

Also I have come things that are all suppose to be capital and they are
returning them with the capitalization removed...ie IBM is now Ibm

"klmiura" wrote:

I have tried this and it does work...sort of; the problem is that I also have
names and it is not displaying them properly..ie McCarthy is being turned
into Mccarthy

"Kevin B" wrote:

Insert a helper column to the right of column A and enter the following
formula:

=PROPER(A1)

Copy down to the last row and then select all of column B and copy it with
Ctrl+C.

Click on cell A1 and then right click on Cell A1 and select PASTE SPECIAL,
click the VALUES check box and click OK to replace all the original values
with there proper name format values. Delete column B when done.
--
Kevin Backmann


"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




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,316
Default Change first letter of every word to Capital

Assuming that the PROPER function has accomplished most of what you want, you
could use FIND AND REPLACE to fix your exceptions like "Ibm" and "Mccarthy".
--
Kevin Backmann


"klmiura" wrote:

Also I have come things that are all suppose to be capital and they are
returning them with the capitalization removed...ie IBM is now Ibm

"klmiura" wrote:

I have tried this and it does work...sort of; the problem is that I also have
names and it is not displaying them properly..ie McCarthy is being turned
into Mccarthy

"Kevin B" wrote:

Insert a helper column to the right of column A and enter the following
formula:

=PROPER(A1)

Copy down to the last row and then select all of column B and copy it with
Ctrl+C.

Click on cell A1 and then right click on Cell A1 and select PASTE SPECIAL,
click the VALUES check box and click OK to replace all the original values
with there proper name format values. Delete column B when done.
--
Kevin Backmann


"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


  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7,247
Default Change first letter of every word to Capital

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

  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,316
Default Change first letter of every word to Capital

Thanks for the cool UDF, I'll be keeping that one handy...
--
Kevin Backmann


"Chip Pearson" wrote:

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


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
excel changes the word true to capital letter Dan Setting up and Configuration of Excel 1 June 13th 08 10:02 AM
change first letter of a word for an entire column lori12844 Excel Discussion (Misc queries) 5 May 30th 07 06:06 AM
How do I format minuscule word in capital letter one in excell? Renato Silvio Excel Discussion (Misc queries) 1 October 11th 06 07:27 PM
New Validation option to format 1st letter as Capital letter Jeff Excel Discussion (Misc queries) 5 July 13th 06 05:11 AM
Default Capital letter for 1st letter of a word Jeff Excel Discussion (Misc queries) 6 July 10th 06 08:36 AM


All times are GMT +1. The time now is 10:48 AM.

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

About Us

"It's about Microsoft Excel"