VBA LCASE Function – Convert Text to Lower Case in Excel

In Excel worksheet, there is a LOWER function that converts a text string into lower case.

Just like the LOWER function, there is a similar inbuilt function in Excel VBA – LCASE

The VBA LCASE function takes a string as the input and converts it into a lower case string.

Syntax of VBA LCASE Function

Below is the syntax of the VBA LCase function

LCase(String)

‘String’ is the text that you want to convert to lower case.

You can use a text string, a range reference that contains the text string, or a variable that has the text string.

Let’s have a look at a couple of example of using the LCase function.

VBA LCase Examples

The below code would convert the specified text into lower case and show it in a message box.

Sub LCaseExample1()
MsgBox LCase("Good Morning")
End Sub

Excel VBA LCase Example 1

Here is another example, where we have used a variable (‘Var’) to hold the text string and then used the LCase function to convert it into lower case.

Sub LCaseExample2()
Dim Var As String
Var = "Good Morning"
MsgBox LCase(Var)
End Sub

Another example below shows how to take the string from a cell (A1) and show the lowercase version of it in a message box.

Sub LCaseExample3()
MsgBox LCase(Range("A1"))
End Sub

While all these above examples work, you’re unlikely to use this function to simply convert or show the lowercase string.

Below is a more practical example of the LCase function in Excel VBA. The below code would go through all the cells in the selected range and convert all the text strings into lower case.

Sub LCaseExample1()
Dim rng As Range
Set rng = Selection
For Each Cell In rng
Cell.Value = LCase(Cell)
Next Cell
End Sub

VBA LCase to convert selection to lower case

A few important things to know about the VBA LCase function:

  1. It affects only the Uppercase characters of the text string. Any character other than the Uppercase text characters is left unchanged.
  2. If you use a null character (or a reference to an empty cell), it will return a null character.

Other Useful VBA Functions:

Excel Ebook Subscribe

FREE EXCEL BOOK

Get 51 Excel Tips Ebook to skyrocket your productivity and get work done faster

Sumit Bansal
Hello there! I'm Sumit Bansal, founder of trumpexcel.com and an Excel MVP. I started this website in 2013 with a simple goal: to share my love for Excel through easy to follow tips, tutorials and videos. I'm here to help you get the best out of MS Excel to save time and boost your productivity.

2 thoughts on “VBA LCASE Function – Convert Text to Lower Case in Excel”

  1. Here is an update:

    Sub LCaseExample1()
    Dim W as Worksheet: set W = ActiveSheet
    Dim R As Range
    Set R = Selection
    Dim cell as Range
    For Each cell In Selection
    Cell.Value = LCase(Cell)
    Next cell
    End Sub

    Reply
  2. Sub LCaseExample1()
    Dim rng As Range
    Set rng = Selection
    For Each Cell In rng
    Cell.Value = LCase(Cell)
    Next Cell
    End Sub

    This code is wrong.
    What about Dim for Cell?

    Reply

Leave a Comment

Free-Excel-Tips-EBook-Sumit-Bansal-1.png

FREE EXCEL E-BOOK

Get 51 Excel Tips Ebook to skyrocket your productivity and get work done faster

Free-Excel-Tips-EBook-Sumit-Bansal-1.png

FREE EXCEL E-BOOK

Get 51 Excel Tips Ebook to skyrocket your productivity and get work done faster

Free Excel Tips EBook Sumit Bansal

FREE EXCEL E-BOOK

Get 51 Excel Tips Ebook to skyrocket your productivity and get work done faster