ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Excell should have a sentence case function like the UPPER() and . (https://www.excelbanter.com/excel-worksheet-functions/6247-excell-should-have-sentence-case-function-like-upper.html)

JBTaylor29

Excell should have a sentence case function like the UPPER() and .
 
Excell should have a sentence case function like the UPPER() and LOWER()
functions. Word does this under format, chance case.

Bernard Liengme

Excel is for numbers
Word is for text
See functions PROPER, UPPER & LOWER

best wishes

--
Bernard Liengme
www.stfx.ca/people/bliengme
remove CAPS in email address


"JBTaylor29" wrote in message
...
Excell should have a sentence case function like the UPPER() and LOWER()
functions. Word does this under format, chance case.




Frank Kabel

Hi
not sure but is PROPER() something for you?

--
Regards
Frank Kabel
Frankfurt, Germany

"JBTaylor29" schrieb im
Newsbeitrag ...
Excell should have a sentence case function like the UPPER() and

LOWER()
functions. Word does this under format, chance case.



Gord Dibben

PROPER is not Sentence Case.

OP would have to use VBA for Sentence Case.


Sub Sentence_Case()
Dim myStr As String
Dim cel As Range
For Each cel In Selection
If cel.HasFormula = True Then Exit Sub
myStr = cel.Value
cel.Value = "=CapFirst(" & """" & myStr & """" & ")"
cel.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlValues
Application.CutCopyMode = False
Next cel
End Sub


Function CapFirst(ByVal str As String) As String
Dim aRegExp As Object, aMatch As Object, allMatches As Object
Set aRegExp = CreateObject("vbscript.regexp")
aRegExp.Pattern = "^[a-z]|\.( )*[a-z]"
aRegExp.Global = True
Set allMatches = aRegExp.Execute(str)
For Each aMatch In allMatches
With aMatch
Mid(str, .firstindex + 1 + .length - 1, 1) = _
UCase(Mid(str, .firstindex + 1 + .length - 1, 1))
End With
Next aMatch
CapFirst = str
End Function


Gord Dibben Excel MVP

On Thu, 11 Nov 2004 21:39:21 +0100, "Frank Kabel"
wrote:

Hi
not sure but is PROPER() something for you?




All times are GMT +1. The time now is 12:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com