Microsoft Excel UCase - LCase Function | Excel Help
Your Programming and Traning Professionals

Microsoft Excel UCase – LCase Function


UCase / LCase Functions

This is another useful set of functions here at Excel help. It is important to remember that the UCase function is used to convert text to ‘Upper Case’ and likewise, LCase is used to convert text to ‘Lower Case’.

The basics:

Now let’s look at an example. Let’s assume we want to process a group of data converting it to both upper and lower case characters. This is our unprocessed data.

Code

Dim StringToProcess As String       ‘The variable that will contain the string to be evaluated

Dim A As Long   ’The counter we will be using the process our records

For A = 2 To 8   ’In this example we only want to process 7 rows

StringToProcess = ActiveSheet.Cells(A, 1).Value   ’We want to process all the values in the first column of the active worksheet. For our

‘example we have fixed the column value at 1 (so it is static) and allow the row value to change

‘as we process the records.

ActiveSheet.Cells(A, 2).Value = UCase(StringToProcess)

ActiveSheet.Cells(A, 3).Value = LCase(StringToProcess)

Next