Column to Proper Case

marka87uk

Board Regular
Joined
Mar 24, 2007
Messages
247
I have some text which is in capitals filling a column. How can I loop though each cell of text and change it to proper case (or simply just change the whole column)? :)
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

Smitty

Legend
Joined
May 15, 2003
Messages
29,536
You can use =PROPER(A1) then Copy-->Paste Special-->Values or try:

Code:
Sub TextCon()
'code by Ivan F. Moala
    Dim oCell As Range, Ans As String
    
    Ans = Application.InputBox("Type in Letter" & vbCr & _
        "(L)owercase, (U)ppercase, (S)entence, (T)itles ")
    If Ans = "" Then Exit Sub
    
    For Each oCell In Selection.SpecialCells(xlCellTypeConstants, 2)
        Select Case UCase(Ans)
            Case "L": oCell = LCase(oCell.Text)
            Case "U": oCell = UCase(oCell.Text)
            Case "S": oCell = UCase(Left(oCell.Text, 1)) & _
                LCase(Right(oCell.Text, Len(oCell.Text) - 1))
            Case "T": oCell = Application.WorksheetFunction.Proper(oCell.Text)
        End Select
    Next

End Sub

HTH,

Smitty
 
Upvote 0

marka87uk

Board Regular
Joined
Mar 24, 2007
Messages
247
Thanks, that pointed me in the right direction. In the end I did this:

Code:
Range("F1").Select
Range(Selection, Selection.End(xlDown)).Select
Dim pCell As Range
For Each pCell In Selection
pCell.Value = Application.WorksheetFunction.Proper(pCell.Value)
Next pCell

Not sure if there is a simpler way but that works fine for me! :)
 
Upvote 0

Forum statistics

Threads
1,186,826
Messages
5,960,020
Members
438,458
Latest member
manojkumarat1999

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top