VBA Code : Convert an entire spreadsheet to uppercase..

How to write a macro to convert an entire spreadsheet to uppercase in Excel :


UCASE Function


VBA Macro Code

This macro code looks like this:

Sub ConvertToUppercase()

   Dim ws As Object
   Dim LCell As Range

   'Turn off screen updating to increase performance
   Application.ScreenUpdating = False
   Application.Calculation = xlCalculationManual

   'Move through each sheet in your spreadsheet
   For Each ws In ActiveWorkbook.Sheets

      On Error Resume Next

      'Convert all constants and text values to proper case
      For Each LCell In Cells.SpecialCells(xlConstants, xlTextValues)
         LCell.Formula = UCase(LCell.Formula)
   Next ws

   'Turn screen updating back on
   Application.Calculation = xlCalculationAutomatic
   Application.ScreenUpdating = True

End Sub

Leave a Reply

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

3 × one =