VBA LCASE Function

VBA LCase Function

Overview of VBA LCase Function:

VBA LCase function is categorized as a Text/String function in VBA. It is a built-in function in MS Office Excel. It converts a string to lowercase text. It has one mandatory String parameter. If input string has Null, then Null is returned as output. It could be used only in VBA function. We can’t use this function in Excel worksheet. The VBA LCase function can be used in either procedure or function in a VBA editor window in Excel. We can use this VBA LCase function any number of times in any number of procedures or functions. In the following section we learn what is the syntax and parameters of the LCase function, where we can use this VBA LCase function and real-time examples.
Table of Contents:

Syntax of VBA LCase Function

The syntax of the VBA LCase function is

LCase (String)

Note: This LCase function returns a string in lower case letters.

Parameters or Arguments

There are two mandatory parameters or arguments for the LCase Function.
Where
string: The string is a mandatory argument. The string which we want to convert to lower case letters.

Where we can apply or use the VBA LCase Function?

We can use this VBA LCase function in MS Office 365, MS Excel 2016, MS Excel 2013, 2011, Excel 2010, Excel 2007, Excel 2003, Excel 2016 for Mac, Excel 2011 for Mac, Excel Online, Excel for iPhone, Excel for iPad, Excel for Android tablets and Excel for Android Mobiles.

Example 1: Convert “AWESOME” string to lower case letters

Here is a simple example of the VBA LCASE function. This below example macro convert given string to lower case letters.

'Convert "AWESOME" string to lower case  letters.
Sub VBA_LCase_Function_Ex1()

    Dim sString As String, sSubString As String
    
    sString = "AWESOME"
    
    sSubString = LCase(sString)
    
    MsgBox "The given string in lower case is :" & sSubString, vbInformation, "VBA LCASE Function"

End Sub

Output: Here is the screen shot of the first example output.
VBA LCASE Function

Example 2: Convert “welcome” string to lower case letters

Here is a simple example of the VBA LCASE function. This below example macro does not affects on lowercase letters.

'Convert "welcome" string to lower case  letters.
Sub VBA_LCase_Function_Ex2()

    Dim sString As String, sSubString As String
    
    sString = "welcome"
    
    sSubString = LCase(sString)
    
    MsgBox "The given string in lower case is :" & sSubString, vbInformation, "VBA LCASE Function"
    
End Sub

Output: Here is the screen shot of the second example output.
VBA LCASE Function

Example 3: Convert “Test 1234 – # $” string to lower case letters

Here is a simple example of the VBA LCASE function. This below example macro does not affects for lowercase letters, Numbers and Special characters.

'Convert "Test 1234 - # $" string to lower case  letters.
Sub VBA_LCase_Function_Ex3()

    Dim sString As String, sSubString As String
    
    sString = "Test 1234 - # $"
    
    sSubString = LCase(sString)
    
    MsgBox "The given string in lower case is :" & sSubString, vbInformation, "VBA LCASE Function"
    
End Sub

Output: Here is the screen shot of the third example output.
VBA LCASE Function

Example 4: Convert Null string to lower case letters

Here is a simple example of the VBA LCASE function. This below example macro returns Null, because specified string contains a Null.

'Convert specified string to lower case  letters.
Sub VBA_LCase_Function_Ex4()

    Dim sString As String, sSubString As String
    
    sString = ""
    
    sSubString = LCase(sString)
    
    MsgBox "The given string in lower case is :" & sSubString, vbInformation, "VBA LCASE Function"
    
End Sub

Output: Here is the screen shot of the fourth example output.
VBA LCASE Function

Instructions to use Macro Codes

Here are the step by step instructions to use the VBA LCase function in Excel VBA.

  • Open an Excel workbook.
  • Press Alt+F11 to open VBA Editor window.
  • Go to Insert menu and click on module from the available options.
  • Copy above specified macros to the VBA editor.
  • Select any procedure from above codes and click on ‘Run’ command or use Keyboard shortcut ‘F5’.

Complete List of VBA Functions:

Please click on below link to go back to see all List of VBA Functions.
List of VBA Functions