VBA & Macro Problems

How to Automatically Capitalize Words in Excel Without a Formula

Amos GikundaAmos Gikunda Sep 28, 2026 872 views

Question details

The user wants to automatically capitalize the first letter of every word entered into specific Excel cells without relying on formulas.

How to Automatically Capitalize Words in Excel Using VBA
Product
Microsoft Excel
Device & OS
Windows and Mac
Scenario
Entering text data into a spreadsheet where consistent proper case formatting is required instantly upon typing.
Observed behavior
Excel does not have a built-in Word-style auto-capitalize feature, requiring the use of formulas or VBA macros to automate text capitalization.
Before you start

Ensure you are using the desktop version of Excel for Windows or Mac, as VBA macros are not supported in Excel for the Web.

Solution 1Recommended

Use a VBA Worksheet_Change Event to Auto-Capitalize Text

Apply a simple VBA script to a specific worksheet to automatically convert typed text to proper case in a defined range.

This method utilizes the VBA StrConv function with the vbProperCase parameter. It triggers automatically whenever data is entered into the specified cells, changing the text formatting as soon as you press Enter.

1
Open the VBA Editor

Right-click the worksheet tab at the bottom of your Excel window and select 'View Code'. This will open the Microsoft Visual Basic for Applications (VBA) editor.

2
Paste the VBA Code

In the code window that appears, paste the following code to target cells B2:B20: Private Sub Worksheet_Change(ByVal Target As Range) Dim rng As Range Dim cel As Range Set rng = Intersect(Range("B2:B20"), Target) If Not rng Is Nothing Then Application.ScreenUpdating = False Application.EnableEvents = False For Each cel In rng cel.Value = StrConv(cel.Value, vbProperCase) Next cel Application.EnableEvents = True Application.ScreenUpdating = True End If End Sub

3
Save as a Macro-Enabled Workbook

Close the VBA editor and go to File > Save As. Change the file format to 'Excel Macro-Enabled Workbook (*.xlsm)' to ensure your code is saved and runs correctly.

Use a VBA Worksheet_Change Event to Auto-Capitalize Text
Adjusting the Target Range: You can change the 'B2:B20' range in the code to any cell or range of cells you need, such as 'A1:A100' or 'C:C' for an entire column.
Advanced Spreadsheets Made Easy

Use WPS Spreadsheet to Run Macros and Automate Tasks

WPS Office fully supports VBA macros, allowing you to seamlessly run text formatting scripts like auto-capitalization without the need for manual formulas.

  1. 1. Open your file in WPS Spreadsheet: Launch WPS Office and open your workbook or create a new one.
  2. 2. Access the VBA Editor: Navigate to the 'Tools' or 'Developer' tab on the ribbon and click on 'VB Editor'.
  3. 3. Insert the Macro Code: Double-click your desired sheet in the Project window and paste the auto-capitalize VBA code.
  4. 4. Save your Document: Save your file as an .xlsm Macro-Enabled Workbook to keep your automations active.
Fully compatible with Microsoft Excel (.xlsm) macro filesBuilt-in Developer tools for easy VBA script editingLightweight, fast performance for large datasetsFree to download and highly user-friendly interface
microsoft office alternative - wps office

Frequently Asked Questions

Can I auto-capitalize text in Excel for Web?

No, Excel for the Web does not support VBA macros. To achieve auto-capitalization online, you must use the PROPER formula in an adjacent column or open the file in a desktop version of Excel.

Why isn't the VBA macro running when I type?

This usually happens if macros are disabled in your Trust Center settings, or if the file was not saved as an .xlsm workbook. Additionally, if a previous macro error halted execution, you may need to run 'Application.EnableEvents = True' in the Immediate Window to restore event triggers.

Is it possible to capitalize the first letter of only the first word?

Yes, but you will need to modify the VBA code. Instead of using 'vbProperCase', you would use a custom function or combination of 'UCase', 'Left', and 'Mid' string functions to capitalize just the first character of the cell.