Trending October 2023 # How To Convert Lower Case In Excel Using Lcase Function? # Suggested November 2023 # Top 13 Popular | Nhunghuounewzealand.com

Trending October 2023 # How To Convert Lower Case In Excel Using Lcase Function? # Suggested November 2023 # Top 13 Popular

You are reading the article How To Convert Lower Case In Excel Using Lcase Function? updated in October 2023 on the website Nhunghuounewzealand.com. We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. Suggested November 2023 How To Convert Lower Case In Excel Using Lcase Function?

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:

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.

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.

Step 3: Then declare a macro Sub Function.

Code:

Sub

Sample()

End Sub

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

Code:

Sub

Sample() Worksheets("Sheet1").Activate

End Sub

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

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

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.

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

Code:

Sub

Sample1()

End Sub

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

Code:

Sub

Sample1()

Dim

A, B

As String

End Sub

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

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

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

Sub

Sample1()

Dim

A, B

As String

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

End Sub

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.

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

Code:

Sub

Sample2()

End Sub

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

Code:

Sub

Sample2() Worksheets("Sheet1").Activate

End Sub

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

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

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,

Step 2: Declare a macro name for this example.

Code:

Sub

Sample3()

End Sub

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

Code:

Sub

Sample3() Worksheets("Sheet2").Activate

End Sub

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

Code:

Sub

Sample3() Worksheets("Sheet2").Activate

Dim

A

As Long

End Sub

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

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

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

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

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 –

You're reading How To Convert Lower Case In Excel Using Lcase Function?

Update the detailed information about How To Convert Lower Case In Excel Using Lcase Function? on the Nhunghuounewzealand.com website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!