ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Change case of text (https://www.excelbanter.com/excel-discussion-misc-queries/59138-change-case-text.html)

Ferd

Change case of text
 
Is there a 'change case' shortcut found in Excel, similar to the one found in
Office Word - under format?

Bob Phillips

Change case of text
 
No, that is a word-processor function. In Excel you would have to create it.
I have a UDF that does sentence case. I am sure it could easily be adapted
to act like Word's F3

Public Function SentenceCase(ByVal para As String) As String
Dim oRegExp As Object
Dim oMatch As Object
Dim oMatches As Object

para = LCase(para)
Set oRegExp = CreateObject("VBScript.RegExp")
oRegExp.Pattern = "^[a-z]|\.( )*[a-z]"
oRegExp.Global = True
Set oMatches = oRegExp.Execute(para)
For Each oMatch In oMatches
With oMatch
Mid(para, .FirstIndex + 1 + .Length - 1, 1) = _
UCase(Mid(para, .FirstIndex + 1 + .Length - 1, 1))
End With
Next oMatch
SentenceCase = para
End Function

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Ferd" wrote in message
...
Is there a 'change case' shortcut found in Excel, similar to the one found

in
Office Word - under format?





All times are GMT +1. The time now is 06:17 PM.

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