LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 390
Default Loop through cells in columns..

In , Jake
spake thusly:

I have a sheet with two columns of names, entered in uppercase
letters.

I need to loop through a given range of cells and change the
case permanently to normal 'name' convention (first character
uppercase and the rest lowercase) for each word in each cell.


Jake,

Names are hard. There are zillions of exceptions. But for a
"quick solution" as you asked:

Sub TitleCase()

Dim myCell As Range
Dim myRight As String

For Each myCell In ActiveSheet.UsedRange
myRight = Right(myCell, Len(myCell) - 1)
myCell = UCase(Left(myCell, 1)) & LCase(myRight)
Next
End Sub


Needs embellishment for all sorts of aforesaid exceptions
(e.g., John Van der Kamp) and perhaps needs error handling
added.

=dman=
 
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
Loop through columns Geir Holmavatn Excel Programming 3 September 5th 06 04:03 PM
Loop through Columns Sally[_6_] Excel Programming 3 August 26th 06 10:52 AM
loop over columns kizzie Excel Discussion (Misc queries) 4 August 10th 05 01:31 PM
loop through columns hotherps[_78_] Excel Programming 6 July 23rd 04 11:40 AM
Loop 20 columns Help! Michael168[_106_] Excel Programming 2 July 2nd 04 12:26 PM


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