VBA to Convert Text from Lower to Uppercase

If you are after a VBA code to allow you to convert all the text in small letters into upper case letter then you should read this tutorial. In this article, we will learn how to convert lower case text to upper case text with VBA macro code.

Question): How can I immediately convert all the text from small to uppercase characters?

To get the code for converting text into upper case letters; we need to follow the below steps to launch VB editor

  • Click on Developer tab
  • From Code group, select Visual Basic

 

img1

 

We have 2 codes & we will look at each one separately. Copy the following code in worksheet module

 

Sub UpperCaseCode1()

    Application.ScreenUpdating = False

    Dim Rng As Range

    Dim c As Range

    On Error Resume Next

    Set Rng = Cells.SpecialCells(xlCellTypeConstants, 2)

    For Each c In Rng

        c.Value = UCase(c.Value)

    Next c

    Application.ScreenUpdating = True

End Sub

 

img2

 

The second code we have is as following:

 

Sub UpperCaseCode2()

    Application.ScreenUpdating = False

    Dim cell As Range

    For Each cell In Range(“$A$1:” & Range(“$A$1″).SpecialCells(xlLastCell).Address)

        If Len(cell) > 0 Then cell = UCase(cell)

    Next cell

    Application.ScreenUpdating = True

End Sub

 

img3

 

  • Both of the codes will convert the small case text into upper case as you run the macro.

In this way, we can convert text from lowercase to uppercase letters, using VBA code.

 

image 4

Download – VBA To Convert Text From Lower To Uppercase – xlsm

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Terms and Conditions of use

The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.

Visit Us On TwitterVisit Us On FacebookVisit Us On Google PlusVisit Us On Youtube