#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 493
Default Sentence Case

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
  #2   Report Post  
Posted to microsoft.public.excel.misc
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

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 493
Default Sentence Case

Thanks Sheeloo,

You saved my life, the code is simple and works just great.

Thanks again...

"Sheeloo" wrote:

(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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I change case to sentence case in groups in excel? Pinetree Excel Discussion (Misc queries) 3 May 30th 07 05:55 AM
Change the text from lower case to upper case in an Excel work boo dave01968 Excel Discussion (Misc queries) 2 December 9th 05 09:09 AM
How to change case on a spreadsheet from Caps to Sentence? Mamacsee Excel Discussion (Misc queries) 1 July 5th 05 09:23 PM
Change Capitals to Sentence Case do Excel Discussion (Misc queries) 2 March 29th 05 02:31 AM
Excell should have a sentence case function like the UPPER() and . JBTaylor29 Excel Worksheet Functions 3 November 11th 04 11:54 PM


All times are GMT +1. The time now is 10:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"