Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 2
Default Capitilize last word in cell

Hi,
I am trying to find a way to capitalize the last word in a cell. I frequently get
names formatted where A1 = First Name A2 = Last name or A1=jan A2=van der hass and need to capitalize the h in hass. I have not been able to find a way to accomplish this. Your help is greatly appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,872
Default Capitilize last word in cell

Hi Mike,

Am Mon, 7 May 2012 17:29:06 +0000 schrieb MikeTi:

I am trying to find a way to capitalize the last word in a cell. I
frequently get
names formatted where A1 = First Name A2 = Last name or A1=jan A2=van
der hass and need to capitalize the h in hass. I have not been able to
find a way to accomplish this. Your help is greatly appreciated.


the simplest way is to do it with VBA.
Formula:
=LEFT(A2,FIND("#",SUBSTITUTE(A2," ","#",LEN(A2)-LEN(SUBSTITUTE(A2," ",)))))&PROPER(SUBSTITUTE(A2,LEFT(A2,FIND("#",SUBS TITUTE(A2," ","#",LEN(A2)-LEN(SUBSTITUTE(A2," ",))))),))
Macro:

Sub Capitalize()
Dim Start As Integer
Dim LRow As Long
Dim rngC As Range

LRow = Cells(Rows.Count, 1).End(xlUp).Row
For Each rngC In Range("A1:A" & LRow)
Start = InStrRev(rngC, " ")
rngC = Left(rngC, Start) & _
WorksheetFunction.Proper(Right(rngC, Len(rngC) - Start))
Next
End Sub


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
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
make cell equal a word if a data validation cell has a word in it Robzz Excel Discussion (Misc queries) 1 February 6th 09 06:20 PM
How to capitilize automatically? [email protected] Excel Programming 13 April 25th 07 04:37 AM
How to capitilize automatically? [email protected] Excel Discussion (Misc queries) 0 April 23rd 07 11:01 PM
Finding a word in a cell, but not when its a substring of another word in the cell Derrick Salmon Excel Programming 2 December 5th 06 03:48 AM
Capitilize first letter Craig Excel Worksheet Functions 8 January 31st 05 03:21 AM


All times are GMT +1. The time now is 09:31 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"