How to Convert Small Letters into Uppercase Letters for few columns using VBA in Microsoft Excel
In this article we will learn how to convert text into capital letters in specific columns (not all cells) using VBA code.
Question): I want code that will replace the text enter in small letters into upper case in some columns (not all of them).
Say I do not want the code to run on columns 4, 6, 9, 12, & 13 i.e. if any text is entered in these columns then the code will not be triggered.
In order to get the upper case letters as you type in small letters; we need to follow the below steps to launch VB editor
Copy the following code in Sheet module
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Column = 4 Or Target.Column = 6 Or Target.Column = 9 _
Or Target.Column = 12 Or Target.Column = 13 Then Exit Sub
On Error GoTo ErrHandler
Application.EnableEvents = False
Target.Formula = UCase(Target.Formula)
Application.EnableEvents = True
In this way, we can convert text to caps in specific columns using VBA code.
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.