Is there a keyboard shortcut to change ALL CAPS to All Caps?

JenniferMurphy

Well-known Member
Joined
Jul 23, 2011
Messages
2,687
Office Version
  1. 365
Platform
  1. Windows
One website that I follow has the annoying preference for ALL CAPS. I like to copy some of the lists to either a Word document or an Excel worksheet. In Word, the keyboard shortcut Shift+F3 will cycle the text between all upper case, all lower case, or one or two versions of first letter capitalization. (a) If the text ends with a period, then it assumes that it is a sentence and it will capitalize the just first letter of the first word. (b) Otherwise, it will capitalize the first letter of every word.

Here is an example:

1712034672821.png


Shift+F3 doesn't seem to work for me in Excel. Is there a way to activate it?

It would be even better if there were a fourth step for titles, where it would capitalize just the words that are normally capitalized on titles. Like this:

1712034742690.png


Is there something like this in Excel? Shift+F3 lets me enter a formula. If so, how do I use it. If not, can I add it?

Thanks
 
For anyone who wants to fool around, a bit slow if you don't have a Word App opened already, but interesting nevertheless:
VBA Code:
Function changeCaseWordApp(ByVal txt As String, xCase As Long) As String
    'Available options for xCase:
        'wdLowerCase = 0
        'wdTitleWord = 2
        'wdUpperCase = 1
        'wdTitleSentence = 4
        'wdToggleCase = 5
        '
        'wdHalfWidth = 6
        'wdFullWidth = 7
        'wdKatakana = 8
        'wdHiragana = 9
        '
        'wdNextCase = -1

    Dim wdApp As Object
    Dim wdRange As Object

    Set wdApp = CreateObject("Word.Application") ' CreateWord 'alternative

    With wdApp
        .Visible = False 'True
        .documents.Add
        Set wdRange = .Selection.Range
        With wdRange
            .text = txt
            .Case = xCase
            changeCaseWordApp = .text
        End With

        .Quit False
    End With
    Set wdRange = Nothing
    Set wdApp = Nothing
    
End Function

'an alternative object creator I found somewhere on the web 
Public Function CreateWord (Optional bVisible As Boolean = True) As Object

    Dim oTempWD As Object

    On Error Resume Next
    Set oTempWD = getObject(, "Word.Application")

    If Err.Number <> 0 Then
        Err.Clear
        On Error GoTo ERROR_HANDLER
        Set oTempWD = CreateObject("Word.Application")
    End If

    oTempWD.Visible = bVisible
    Set CreateWord = oTempWD

    On Error GoTo 0
    Exit Function

ERROR_HANDLER:
    Select Case Err.Number

        Case Else
            MsgBox "Error " & Err.Number & vbCr & _
                " (" & Err.Description & ") in procedure CreateWord."
            Err.Clear
    End Select

End Function
 
Upvote 0

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
bobsan42,
I am curious why your line for 'Proper' format works in the code below, however a similar code for 'Upper' and 'Lower' causes 'error 438, Object doesn't support this property or method'.
Perhaps you might explain.
Thank you in advance.
Perpa

VBA Code:
Private Function reCase(ByRef x As String, ByVal MyChoice As String) As String
    
If MyChoice = "allcaps" Then
reCase = UCase$(x)

'reCase = Application.WorksheetFunction.Upper(x)   'Causes Error 438

ElseIf MyChoice = "proper" Then 'allows upper or lower case selection
reCase = Application.WorksheetFunction.Proper(x)
ElseIf MyChoice = "lower" Then 'allows upper or lower case selection
reCase = LCase$(x)

'reCase = Application.WorksheetFunction.Lower(x)   'Causes Error 438

    End If
End Function
 
Upvote 0
I cannot confirm immediately, but I guess that the worksheetfunction class only exposes functions which do not have an equivalent in VBA. And it does not expose all functions available to excel formulas.
 
Upvote 0
To explore (most of) the availlable methods and properties of a class, put the cursor on its name in code and press Shift+F2 (or right click on the name and select Definition).
Same goes for variables in the code.
 
Upvote 0
however a similar code for 'Upper' and 'Lower' causes 'error 438,
Because VBA has UCase and LCase and so doesn't need a Worksheetfunction that does the same job.

A list of the Worksheetfunction methods available in VBA that Microsoft list is in the link below
 
Upvote 0

Forum statistics

Threads
1,223,838
Messages
6,174,933
Members
452,593
Latest member
Jason5710

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top