Thread: Sentence Case
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Sheeloo Sheeloo is offline
external usenet poster
 
Posts: 793
Default Sentence Case

(Source: http://www.angelfire.com/biz7/julian...ans_macros.htm)
<To change text in a selected range to sentence case use this code. This
code was supplied by Simon Huggins.

Sub SentenceCase()
For Each cell In Selection.Cells
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


"Alex" wrote:

Hi,

I tried several posted macros for Sentence Case to make every first letter
of every sentence in a cell - Capital one. No success. Every time I get the
same result: #NAME?
Is there any easy way to do that?

Thanks,
Alex