ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Loop through cells in columns.. (https://www.excelbanter.com/excel-programming/395774-loop-through-cells-columns.html)

Jake[_14_]

Loop through cells in columns..
 
Hi,

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.

Thanks a LOT if someone has a quick solution for this

regards

Jake

Pranav Vaidya

Loop through cells in columns..
 
I think you don't need a macro for this. Follow the below steps
Assume that your names are in column A. the name are entered like this, for
example my name PRANAV VAIDYA (first name & last name)

Say in column C enter this formula
=PROPER(A1)

Drag this formula tll end of your list
The copy and paste special values the names.

--
Pranav Vaidya
VBA Developer
PN, MH-India
If you think my answer is useful, please rate this post as an ANSWER!!


"Jake" wrote:

Hi,

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.

Thanks a LOT if someone has a quick solution for this

regards

Jake


Mike H

Loop through cells in columns..
 
Jake,

Right click the sheet tab, view code and paste this in and run it.

Sub sonic()
Set myrange = Range("A1:B100") 'Change to suit
For Each c In myrange
c.Value = Application.WorksheetFunction.Proper(c.Value)
Next
End Sub

Mike

"Jake" wrote:

Hi,

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.

Thanks a LOT if someone has a quick solution for this

regards

Jake


Dallman Ross

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=


All times are GMT +1. The time now is 05:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com