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

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

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
 

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! :)
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,322
Messages
5,769,446
Members
425,546
Latest member
DisMissive

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