Home |
Search |
Today's Posts |
#1
|
|||
|
|||
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
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
make cell equal a word if a data validation cell has a word in it | Excel Discussion (Misc queries) | |||
How to capitilize automatically? | Excel Programming | |||
How to capitilize automatically? | Excel Discussion (Misc queries) | |||
Finding a word in a cell, but not when its a substring of another word in the cell | Excel Programming | |||
Capitilize first letter | Excel Worksheet Functions |