View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default convert text to sentence case

You sure you want "sentence case" and not Proper Case.

This is sentence case.

This Is Proper Case.

You can convert to Proper Case using the PROPER function in a helper column
or running a macro on the whole sheet.

Macro for Proper Case on selected cells...........................

Sub Proper()
Dim Cell As Range
Application.ScreenUpdating = False
For Each Cell In Selection
Cell.Formula = Application.Proper(Cell.Formula)
Next
Application.ScreenUpdating = True
End Sub

Macro for Senetnce case....................................

Sub Sentence_Case()
For Each Cell In ActiveSheet.UsedRange. _
SpecialCells(xlTextValues)
s = Cell.Value
Start = True
For I = 1 To Len(s)
ch = Mid(s, I, 1)
Select Case ch
Case "."
Start = True
Case "?"
Start = True
Case "a" To "z"
If Start Then ch = UCase(ch): Start = False
Case "A" To "Z"
If Start Then Start = False Else ch = LCase(ch)
End Select
Mid(s, I, 1) = ch
Next
Cell.Value = s
Next
End Sub


Gord Dibben MS Excel MVP

On Tue, 20 Jan 2009 12:54:05 -0800, Jacqueline
wrote:

Is there a way to convert all cap text to sentence case in Excel. I have to
dump data from one database into an Excel spreadsheet, where the data is
scrubed and then appended to a table in another database.

The data comes from the first database in all caps! Any help is greatly
appreciated.
Thanks