VBA Lowercase Strings: Using LCase and Common Fixes

VBA & macros · Updated November 17, 2026

To convert text to lowercase in VBA, use the built-in LCase function: for example, lowerText = LCase(originalText). It returns a lowercase version of the supplied string; it does not change the original variable or worksheet cell unless you assign the result back or write it to a range.

What LCase Does

LCase changes uppercase letters in a string to their lowercase equivalents while leaving characters that have no uppercase form, such as digits and most punctuation, unchanged. For example, applying it to "Quarterly SALES 2026!" produces "quarterly sales 2026!". The function is part of VBA, so you can use it in Excel macros, UserForms, and other VBA projects without enabling an additional reference.

The function returns a value rather than editing text in place. If you call it and discard the result, the original variable remains as it was. Assign the result to a variable, a property, or a cell to retain the converted text. This distinction matters in macros that clean imported data: calling LCase alone does not alter the source range.

Basic Syntax and Examples

The syntax is LCase(string), where string is an expression that VBA can evaluate as text. The result is the text with uppercase letters converted to lowercase. For a variable named customerName, assign the result to another variable or back to the same one.

Sub MakeTextLowercase()
    Dim originalText As String
    Dim lowerText As String

    ' Convert the text and keep the result.
    originalText = "Northwind SALES"
    lowerText = LCase(originalText)

    MsgBox lowerText
End Sub

The message box displays northwind sales. Assigning the result back to the original variable is also valid: originalText = LCase(originalText). If you use that pattern, the variable contains only the converted text afterward, so retain a separate copy first if the original capitalization may be needed later.

VBA also provides LCase$, the string-returning form of the function. It is useful when you specifically want a String result; in ordinary VBA code, LCase is clear and commonly used. Do not confuse either form with an Excel worksheet formula: the worksheet function is LOWER, not LCase.

Lowercase Text in Excel Cells

A macro can convert values in a worksheet range by reading each cell, applying LCase, and writing the result back. The following example works through A2:A20 on the active sheet. It skips empty cells and cells containing Excel errors, then replaces the remaining cell contents with lowercase text.

Sub LowercaseColumnA()
    Dim ws As Worksheet
    Dim cell As Range
    Dim cellValue As Variant

    ' Save a copy before running: macros cannot be undone with Ctrl+Z.
    Set ws = ActiveSheet

    For Each cell In ws.Range("A2:A20")
        cellValue = cell.Value
        If Not IsError(cellValue) Then
            If Not IsEmpty(cellValue) Then
                cell.Value = LCase(CStr(cellValue))
            End If
        End If
    Next cell
End Sub

This example writes over the original values, so make a copy of the workbook before running it. Excel does not provide a Ctrl+Z undo for changes made by a macro. If you want to preserve the source, write the converted values to a different column instead, such as column B, and leave column A untouched. Also note that writing text back to a cell replaces a formula in that cell with its current value.

To run the macro in Excel for Microsoft 365 on Windows, press Alt+F11 to open the Visual Basic Editor, choose Insert > Module, paste the code, and run the procedure with the cursor inside it. On a Mac, use Option+F11 or the Visual Basic Editor command, depending on the keyboard and Excel settings; some keyboards require the Fn key. Excel for the web can open workbooks containing macros, but it cannot create, edit, or run VBA macros. Use desktop Excel for this procedure.

Use LCase in a User-Defined Function

If you want a worksheet cell to show a lowercase result without replacing the source, create a VBA User-Defined Function (UDF). This is distinct from Excel’s built-in LOWER formula, which is usually simpler for ordinary cell conversion. A UDF can be useful when lowercase conversion is one part of a larger custom VBA operation.

Function LowercaseText(ByVal inputText As String) As String
    ' Return a lowercase copy for use in a worksheet formula.
    LowercaseText = LCase(inputText)
End Function

After adding the function to a standard VBA module, a worksheet can call it with =LowercaseText(A2). Save the workbook in a macro-enabled format such as .xlsm, and enable macros only when you trust the workbook. A UDF generally recalculates when its input changes, but it cannot be used in Excel for the web because that environment does not run VBA. For a simple case conversion, the built-in worksheet formula avoids those macro requirements.

LCase Compared with Excel LOWER

Choose the tool based on where you need the conversion and whether the result should remain dynamic. In a worksheet, enter =LOWER(A2) in a cell to display a lowercase version of A2 while keeping the source unchanged. Fill the formula down for more rows. In VBA, use LCase when your code needs to transform a string as part of a procedure, such as normalizing a value before comparing it.

  • Use worksheet LOWER for a visible, formula-based result that updates when its input changes.
  • Use VBA LCase when a macro needs a lowercase string for a decision, message, lookup preparation, or controlled range update.
  • Use Find and Replace or manual editing only when appropriate; neither is a general automatic lowercase conversion tool for varied text.

There is no standard Excel ribbon command that simply changes selected text to lowercase in place. A formula or macro is the usual route. If you use a formula and later need fixed text, copy the result and use Paste Special > Values. On Windows, the Paste Special dialog can be opened with Ctrl+Alt+V; on Mac, use the Paste Special command from the Edit menu or the context menu, since shortcuts can vary by Excel version and keyboard.

Case Conversion and Text Comparisons

A common reason to use LCase is to make text comparisons easier to read or to normalize values. For example, VBA’s default text comparison behavior is controlled by the module’s Option Compare setting, and comparisons may be case-insensitive under Option Compare Text. In contrast, Option Compare Binary compares character codes and is case-sensitive. Converting both values with LCase can make the intent explicit, but it is not always necessary.

For instance, a macro can compare LCase(inputText) with "approved" if the input might be APPROVED, Approved, or approved. Another option is to use StrComp with vbTextCompare for a text comparison. These approaches are not identical in every locale, so for identifiers with specific language or sorting rules, choose and test a comparison method deliberately.

Lowercasing is also not the same as trimming spaces. If input may contain spaces before or after the word, LCase preserves them. Apply Trim separately when removing leading and trailing spaces is appropriate. Do not remove spaces indiscriminately if they are meaningful, such as in a password, code, or exact source record.

Common Problems and Limitations

  • The cell did not change: The result may not have been assigned. Store it in a variable or write it to a range; LCase does not mutate its argument.
  • A macro raises a type mismatch: A cell may contain an Excel error value, such as #N/A, rather than text. Check with IsError before passing a cell value to a text conversion.
  • Numbers appear unchanged: Digits do not have uppercase and lowercase forms. If a cell contains a number, converting it to text does not turn it into a different number.
  • The source formula disappeared: A macro that writes to a formula cell replaces the formula with a value. Write results to another range or work on a copy when formulas must be preserved.
  • Accented or language-specific letters behave unexpectedly: Case conversion can depend on locale and character support. Test representative text from the languages used in the workbook rather than assuming that lowercase conversion performs every language’s full text-normalization rules.

VBA’s case conversion is not a substitute for Unicode normalization, transliteration, or language-aware search. Some characters have special casing rules, and lowercasing does not guarantee that two visually similar strings become identical. It also does not remove diacritics or convert a string into a universal, locale-independent comparison key. For ordinary English labels and many common spreadsheet tasks, LCase is suitable; for multilingual identifiers, verify the behavior required by the application.

Choosing a Safe Workflow

Before converting a large range, decide whether the original text must be retained, whether formulas should remain formulas, and how blanks, errors, and non-text values should be handled. A safe workflow is to test on a small sample or a duplicate sheet, then inspect the output before applying the change to the full dataset.

  1. Save a separate copy of the workbook, especially before using a macro that overwrites cells.
  2. Choose a destination: a helper column preserves the original, while writing to the source range replaces it.
  3. Define how to treat blank cells, error values, numbers, and cells containing formulas.
  4. Test text with punctuation, accented characters, and any relevant non-English letters.
  5. Review the converted results and confirm that downstream formulas, imports, or matching steps still work.

For large ranges, avoid unnecessary cell-by-cell interactions if performance becomes an issue. A more advanced macro can load a range into a Variant array, transform its elements in memory, and write the array back in one operation. That method can be faster, but it needs careful handling of single-cell ranges, errors, and mixed data types. For a modest list, the straightforward loop is often easier to maintain and audit.

Frequently Asked Questions

What is the VBA function for lowercase?
Use LCase, as in result = LCase(source). It returns a lowercase version of the text, which you must assign if you want to keep the result.

Does LCase change the original string?
No. It returns a converted value and leaves the supplied variable unchanged unless you assign the result back to that variable or write it to a cell.

What is the difference between LCase and LOWER?
LCase is a VBA function for use in code. LOWER is the Excel worksheet function used in a cell formula, such as =LOWER(A2).

How do I make an entire Excel column lowercase?
Use a helper column with =LOWER(A2) and fill the formula down, or run a VBA loop over the target cells. The helper-column method preserves the source; a macro that writes back to the same cells overwrites them.

Can I use LCase in Excel for the web?
Not as a running VBA macro. Excel for the web does not run VBA, but its worksheets support the built-in LOWER formula. Open the workbook in desktop Excel to run VBA code.

Does LCase remove spaces or punctuation?
No. It converts letter case only. Use a separate operation such as Trim if removing leading and trailing spaces is appropriate, and use purpose-built text handling for other characters.

Related

Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.

More in VBA & macros

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.