VBA Code : Convert an entire spreadsheet to uppercase..

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
      ws.Activate

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

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

End Sub



Share this post

Post Comment

4 × 4 =