EDUCBA Logo

EDUCBA

MENUMENU
  • Explore
    • EDUCBA Pro
    • PRO Bundles
    • Featured Skills
    • New & Trending
    • Fresh Entries
    • Finance
    • Data Science
    • Programming and Dev
    • Excel
    • Marketing
    • HR
    • PDP
    • VFX and Design
    • Project Management
    • Exam Prep
    • All Courses
  • Blog
  • Enterprise
  • Free Courses
  • Log in
  • Sign Up
Home VBA VBA Resources VBA String and Text Functions VBA LCase
 

VBA LCase

Madhuri Thakur
Article byMadhuri Thakur

Updated June 6, 2023

VBA LCase

 

 

Excel VBA LCase Function

In this article, we will discuss changing the text value to lower case. We can do this by the LCase function in VBA. Similar to the UCase, LCase changes the upper case characters to lower case characters in VBA. The syntax will be as follows to use the Lcase function in VBA:

Watch our Demo Courses and Videos

Valuation, Hadoop, Excel, Mobile Apps, Web Development & many more.

Syntax of LCase in Excel VBA

The syntax for the LCase function Excel VBA is as follows:

VBA LCase

The string is the input we provide to the function. The input can be a single cell or a group of cells, or a whole cell range. If we use Lcase, it only changes the text to the lower case, but it does not change the structure of the text. For example, if we have a semicolon or a comma in our text, it remains untouched. For example, if we input Lcase ( EVERYTHING ), the result we will have is everything. Secondly, in an example, if we have an input such as Lcase (ANAND, ARAN / NEERAJ ), the result will be as follows: Anand, aran / Neeraj.

Let us use this function in a few examples, which will provide a better thought process about the function.

Note: Keep in mind to enable the developer’s tab from the files tab and then from the options section to use VBA in Excel.

How to Use Excel VBA LCase Function?

We will learn how to use a VBA LCase with a few examples in Excel.

You can download this VBA LCase Excel Template here – VBA LCase Excel Template

VBA LCase Function – Example #1

I have a string inside cell A1 of sheet 1. The string is in upper case; we will convert it to lower case using the Lcase function. Have a look at the string below.

VBA Example

Follow the below steps to use LCase in Excel VBA.

Step 1: We start by going to the developer’s tab to open VB Editor from a Visual Basic Option.

VBA LCase Example 1

Step 2: Now click on the Insert tab, which will show us to insert a module in the VBA. To start writing the code, double-click on the module.

Module VBA LCase Function

Step 3: Then declare a macro Sub Function.

Code:

Sub Sample()

End Sub

Sub Sample module of VBA

Step 4: To use any of the sheet properties, we must first activate the sheet.

Code:

Sub Sample()

Worksheets("Sheet1").Activate

End Sub

Activate WorkSheet

Step 5: Now, let us change the value in cell A1 by using the LCase Function as follows.

Code:

Sub Sample()

Worksheets("Sheet1").Activate
Range("A1").Value = LCase(Range("A1"))

End Sub

Range oF Worksheet

Step 6: We get the following result when we run the above code.

VBA LCase 1

We changed the text from upper to lower case in the above example using the Lcase function.

VBA LCase Function – Example #2

Let us take input from the user in the Upper case and change the value of the text to lower case using the Lcase function.

Step 1: Again, we start by going to VB Editor from Visual Basic under the developer’s tab.

VBA LCase 2

Step 2: Click on the Insert tab and add a new module.

Module VBA LCase 2

Step 3: Declare a second macro different from the first one, as two macros cannot have the same name.

Code:

Sub Sample1()

End Sub

Sub Sample 1

Step 4: Use Dim to declare two variables, A and B, as strings.

Code:

Sub Sample1()

Dim A, B As String

End Sub

Dim A as string

Step 5: Use the Inputbox function to take input from the user and store the value in variable A.

Code:

Sub Sample1()

Dim A, B As String
A = InputBox("Write a string", "In Uppercase")

End Sub

Input String

Step 6: In the B store, the value of the Input string is changed from upper case to lower case using the Lcase function.

Code:

Sub Sample1()

Dim A, B As String
A = InputBox("Write a string", "In Uppercase")
B = LCase(A)

End Sub

Lower Case

Step 7: Use the Msgbox Function to display the result.

Code:

Sub Sample1()

Dim A, B As String
A = InputBox("Write a string", "In Uppercase")
B = LCase(A)
MsgBox B

End Sub

MsgBox

Step 8: Run the above code by pressing F5, and we get a prompt to give a value. Input any string. Click on OK to see the result.

VBA LCase 2

VBA LCase Function – Example #3

Above, we have discussed how this Lcase function does not affect the structure of the string, i.e., if there is a comma, a semicolon, or any other special character, it remains unaffected. I have a string in cell C1 with some special characters for demonstration. It is as below,

Step 1: Again, we start by going to VB Editor from Visual Basic under the developer’s tab.

VBA LCase 3

Step 2: Click Insert and add the module above to let us write the code in the same module.

MODULE

Step 3: Declare a third macro name using the Sub Function.

Code:

Sub Sample2()

End Sub

VBA LCase Example 3

Step 4: To use the string in cell C1, we need to activate sheet 1 first.

Code:

Sub Sample2()

Worksheets("Sheet1").Activate

End Sub

Sheet 1

Step 5: Now, let us use the LCase function on cell C1 to check whether it affects the special characters or not.

Code:

Sub Sample2()

Worksheets("Sheet1").Activate
Range("c1").Value = LCase(Range("c1"))

End Sub

LCase Range

Step 6: Execute the above code using the run button and see the following result.

VBA LCase 3

We can see that Lcase does not affect any of the special characters in the string.

VBA LCase Function – Example #4

Now in this example, let us change a range of data from upper to lower case using the LCase function. For demonstration, my data is in Sheet 2, which is as follows,

VBA LCase Example 4

I want to change the strings in column A, which are in upper case, to lower case in column B.

Step 1: Click on the Insert Tab and add the module

Module VBA LCase 4

Step 2: Declare a macro name for this example.

Code:

Sub Sample3()

End Sub

VBA LCase Example 4.1

Step 3: Activate sheet 2 first to use its properties.

Code:

Sub Sample3()

Worksheets("Sheet2").Activate

End Sub

VBA LCase Example 4.2

Step 4: Declare a variable A and its data type as long.

Code:

Sub Sample3()

Worksheets("Sheet2").Activate
Dim A As Long

End Sub

vba value Example 4.3

Step 5: Now, we will use for loop to loop the next data in the next row.

Code:

Sub Sample3()

Worksheets("Sheet2").Activate
Dim A As Long
For A = 2 To 6

End Sub

vba LCase Example 4.4

Step 6: Let us change the value in column A to lower case and store it in column B by the following code.

Code:

Sub Sample3()

Worksheets("Sheet2").Activate
Dim A As Long
For A = 2 To 6
Cells(A, 2).Value = LCase(Cells(A, 1).Value)

End Sub

VBA LCase Example 4.5

Step 7: Loop until the last row is found,

Code:

Sub Sample3()

Worksheets("Sheet2").Activate
Dim A As Long
For A = 2 To 6
Cells(A, 2).Value = LCase(Cells(A, 1).Value)
Next A

End Sub

VBA LCase Example 4.6

Step 8: We get the following result when we run the above code.

VBA LCase 4

Things to Remember

  • Lcase changes text to lower case.
  • The input we provide to the function can be a single cell or a range of cells.
  • It remains unchanged if the input function has any special symbols or characters.

Recommended Articles

This is a guide to VBA LCase. Here we discuss how to use Excel VBA LCase Function, practical examples, and a downloadable Excel template. You can also go through our other suggested articles –

  1. VBA InStr
  2. VBA Integer
  3. Excel VBA MsgBox
  4. VBA Transpose

Primary Sidebar

Footer

Follow us!
  • EDUCBA FacebookEDUCBA TwitterEDUCBA LinkedINEDUCBA Instagram
  • EDUCBA YoutubeEDUCBA CourseraEDUCBA Udemy
APPS
EDUCBA Android AppEDUCBA iOS App
Blog
  • Blog
  • Free Tutorials
  • About us
  • Contact us
  • Log in
Courses
  • Enterprise Solutions
  • Free Courses
  • Explore Programs
  • All Courses
  • All in One Bundles
  • Sign up
Email
  • [email protected]

ISO 10004:2018 & ISO 9001:2015 Certified

© 2025 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA
Watch our Demo Courses and Videos

Valuation, Hadoop, Excel, Web Development & many more.

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

EDUCBA

Download VBA LCase Excel Template

EDUCBA Login

Forgot Password?

🚀 Limited Time Offer! - ENROLL NOW