How can I convert strings to lower case using VBA?

Using VBA, you can convert strings to lower case by using the StrConv function. This function takes two arguments, the string to convert and the type of conversion desired (in this case, vbLowerCase). The result is a new string, which is the converted version of the original string. To use this, you must first declare a variable to hold the result, then call the StrConv function, providing the string to convert and the conversion type as arguments. The result will be the converted string, which can then be used as needed.


You can use the LCase function in VBA to convert strings to lowercase.

You can use the following syntax to convert a range of cells with strings to lowercase:

Sub ConvertToLowerCase()
    
    Dim i As Integer

    For i = 2 To 10
        Range("B" & i) = LCase(Range("A" & i))
    Next i
    
End Sub

This particular example will convert each string in the range A2:A10 to lowercase and display the results in the range B2:B10.

The following example shows how to use this syntax in practice.

Example: Convert Strings to Lowercase Using VBA

Suppose we have the following column of strings in Excel:

Suppose we would like to convert each string in column A to lowercase and display the results in column B:

We can create the following macro to do so:

Sub ConvertToLowerCase()
    
    Dim i As Integer

    For i = 2 To 10
        Range("B" & i) = LCase(Range("A" & i))
    Next i
    
End Sub

When we run this macro, we receive the following output:

Column B displays each string in column A in lowercase.

Note: You can find the complete documentation for the LCase function in VBA .

x