Macro or Formula to change all characters to uppercase

IGinc

Board Regular
Joined
Jun 14, 2009
Messages
148
Dear Board:

I have several worksheets with a large amount of data.

Worksheets: Contain characters some lower case some uppercase.

Goal of Macro: I would like ALL characters in each entire worksheet to be changed to uppercase.

Is this possible? I am limited to excel formulas at this point. Thanks in advance.
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
This should do what you are asking.
Code:
Sub ConvertToUpperCase()
Dim Rng As Range
    For Each ws In Worksheets
        For Each Rng In ActiveSheet.UsedRange.Cells
            If Rng.HasFormula = False Then 'Ensures Formulas are bypassed
                Rng.Value = UCase(Rng.Value)
            End If
        Next Rng
    Next ws
End Sub
 
Upvote 0
This should do what you are asking.
Code:
Sub ConvertToUpperCase()
Dim Rng As Range
    For Each ws In Worksheets
        For Each Rng In ActiveSheet.UsedRange.Cells
            If Rng.HasFormula = False Then 'Ensures Formulas are bypassed
                Rng.Value = UCase(Rng.Value)
            End If
        Next Rng
    Next ws
End Sub

Thank you for your reply.

When running the macro I receive the following error :

'Run Time Error 13'

Type Mismatch

when debugging this is the error/highlighted line:

Rng.Value = UCase(Rng.Value)

Looking forward to a working solution.
 
Upvote 0
Sorry, I did not test the code on my entire workbook.
Note small change in "UsedRange" line:
Code:
Sub ConvertToUpperCase()
Dim Rng As Range
    For Each ws In Worksheets
        For Each Rng In ws.UsedRange.Cells
            If Rng.HasFormula = False Then 'Ensures Formulas are bypassed
                Rng.Value = UCase(Rng.Value)
            End If
        Next Rng
    Next ws
End Sub
This works in my test workbook, but I don't have any unusual sheets, just data, tables, and formulas.
 
Upvote 0
Sorry, I did not test the code on my entire workbook.
Note small change in "UsedRange" line:
Code:
Sub ConvertToUpperCase()
Dim Rng As Range
    For Each ws In Worksheets
        For Each Rng In ws.UsedRange.Cells
            If Rng.HasFormula = False Then 'Ensures Formulas are bypassed
                Rng.Value = UCase(Rng.Value)
            End If
        Next Rng
    Next ws
End Sub
This works in my test workbook, but I don't have any unusual sheets, just data, tables, and formulas.

I will try this code out. Could it be that the code does not work, because I explained it wrong. There is only one tab on this particular excel file. I failed to mention that some of my excel files, have just one tab, where others have multiple tabs.
 
Upvote 0
Also the data only has cells, some with different colors, regular data and formulas as well. Most are just data, some have Vlookup, SUM no other macros.
 
Upvote 0
John,

I've run the macro on two other work sheets, with single tabs and it worked. I'm wondering why it wont work on this particular worksheet the only formulas it has is concatante, and . It is a small enough file that I can use upper, thanks for your help, though it would be nice if the macro worked on this file. Thanks again.

Mike
 
Upvote 0
I have tested the code on a workbook with only one worksheet and it works fine. Even tested against "Merged Cells" that causes errors in some macros, but they change to upper case fine.

Your failing workbook must have something unusual that causes the error.
 
Upvote 0

Forum statistics

Threads
1,224,583
Messages
6,179,682
Members
452,937
Latest member
Bhg1984

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top