Skip to main content

How to change text strings to sentence case in Microsoft Excel?

You may need to change text strings to sentence case in Microsoft Excel. Supposing there are hundreds of text strings in uppercase or lowercase, changing them manually one by one is not a good choice. Are there easy tricks to change text strings to sentence case in Microsoft Excel?


arrow blue right bubble Change text strings to sentence case in Excel with VBA

If you are experienced with Microsoft Excel, using VBA is a good choice to change text strings to sentence case.

Step 1: Hold down the ALT + F11 keys, and it opens the Microsoft Visual Basic for Applications window.

Step 2: Click Insert > Module, and paste the following macro in the Module window.

Sub SentenceCase()
'Updateby20131127
Dim Rng As Range
Dim WorkRng As Range
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
For Each Rng In WorkRng
    xValue = Rng.Value
    xStart = True
    For i = 1 To VBA.Len(xValue)
        ch = Mid(xValue, i, 1)
        Select Case ch
            Case "."
            xStart = True
            Case "?"
            xStart = True
            Case "a" To "z"
            If xStart Then
                ch = UCase(ch)
                xStart = False
            End If
            Case "A" To "Z"
            If xStart Then
                xStart = False
            Else
                ch = LCase(ch)
            End If
        End Select
        Mid(xValue, i, 1) = ch
    Next
    Rng.Value = xValue
Next
End Sub

Step 3: Press the F5 key to run this macro, then a dialog is popped up on the screen for selecting a range, see screenshot:

doc-change-case7

Step 4: Click Ok, and you can see the result as shown as below:


arrow blue right bubble Change text strings to sentence case in Excel with Kutools for Excel

Kutools for Excel: with more than 300 handy Excel add-ins, free to try with no limitation in 30 days. Get it Now

VBA macro may be not easy for starter users of Microsoft Excel. Please do not worry about it. Kutools for Excel's Change Case tool can change all text strings to sentence case in selections quickly.

Step 1: Select the range in which you will change text strings to sentence case.

Step 2: Click the Kutools > Text Tools > Change Case…. See screenshot:

Step 3: In Change Case dialog box, check the Sentence Case. Option, and click OK or Apply button.

Then you will view all kinds of text strings are changed to sentence case in the selection. See the following figure:

Kutools for Excel's Change Case tool can quickly change text case to UPPER, LOWER, PROPER, Sentence Case, and tOGGLE cASE. Click to know more…


Relative articles:

Best Office Productivity Tools

🤖 Kutools AI Aide: Revolutionize data analysis based on: Intelligent Execution   |  Generate Code  |  Create Custom Formulas  |  Analyze Data and Generate Charts  |  Invoke Kutools Functions
Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...

Description


Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!

Comments (5)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Here is simple way of converting any text with multiple sentences to Sentence Case. The comments on the right show how the text gets transformed at each step. Private Function SentenceConvert(strText As String) As String strText = LCase(strText) 'I GO. i went. --> i go. i went. strText = Replace(Replace(Replace(strText, ". ", ".~"), "? ", "?~"), "! ", "!~") 'i go. i went. --> i go.~i went. strText = Replace(strText, " ", "^") 'i go.~i went. --> i^go.~i^went. strText = Replace(strText, "~", " ") 'i^go.~i^went. --> i^go. i^went. strText = StrConv(strText, vbProperCase) 'i^go. i went. --> I^go. I^went. strText = Replace(strText, "^", " ") 'I^go. I^went. --> I go. I went. strText = Replace(strText, " i ", " I ") SentenceConvert = strText End Function
This comment was minimized by the moderator on the site
OR you could simply copy the selection to MS Word, change to sentence case there and copy back.
This comment was minimized by the moderator on the site
Good macro, but it would help to have all the variables defined.
This comment was minimized by the moderator on the site
Really helpful! Thanks! :lol:
This comment was minimized by the moderator on the site
Thanks for the great tutorial for the macro! I noticed though that any sentences following a sentence ending in an exclamation point did not get capitalized. How do I add this to the macro?
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations