Search
Close this search box.

VBA – LCase String


The LCase function in VBA converts all uppercase letters within a string to lowercase letters.

Syntax:

LCase(string)

Parameter:

 

  • string: The string whose uppercase letters you want to convert to lowercase.


Return Value:

  • String: Returns the original string with all uppercase letters converted to lowercase.

 

Example

				
					Dim str1 As String
Dim lowerCaseStr As String

str1 = "Hello, World!"
lowerCaseStr = LCase(str1) 

' lowerCaseStr will be "hello, world!"
				
			

Use Cases:

  • Case-Insensitive Comparisons:
    • Comparing strings without regard to case.
    • Searching for strings regardless of their case.
  • Data Normalization:
    • Converting strings to a consistent lowercase format for data entry or analysis.
  • Database Queries:
    • Creating case-insensitive search criteria in database queries.

Key Considerations:

  • Only uppercase letters are converted to lowercase.
  • Lowercase letters, numbers, and other characters remain unchanged.