Macro For Upper Case etc..

Dazzawm

Well-known Member
Joined
Jan 24, 2011
Messages
3,786
Office Version
  1. 365
Platform
  1. Windows
Is there a macro where I can highlight a column and it will change it to upper case and then I can adapt it to lower case or proper case when needed. I have a hell of a lot of columns, spreadsheets to do so doing it the formula way then copy paste special values will be a big hassle.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Try this: select the range then run the macro

Code:
Sub ToCaps()
Dim c As Range
For Each c In Selection
    c.Value = UCase(c.Value)
Next c
End Sub
 
Upvote 0
Thanks do I change 'UCase' to LCase or Proper when needed?
 
Upvote 0
For lower case use LCase.

For Proper case either

Code:
c.Value = StrConv(c.Value, vbProperCase)

or

Code:
c.Value = WorksheetFunction.Proper(c.Value)
 
Upvote 0
Try this:
http://www.mrexcel.com/forum/<WBR>showthread.php?p=1915636#<WBR>post1915636
Code:
 Sub test()
'Seiya: Text case
Dim myCase, rng As Range, r As Range
myCase = Application.InputBox("Enter" & vbLf & "1 for Upper Case" & vbLf & _
                    "2 for Lower Case" & vbLf & "3 for Proper Case", type:=1)
If (myCase = False) + (Not myCase Like "[1-3]") Then Exit Sub
On Error Resume Next
Set rng = Selection.SpecialCells(2)
On Error GoTo 0
If Not rng Is Nothing Then
    For Each r In rng
        r.Value = StrConv(r.Value, myCase)
    Next
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,583
Messages
6,179,673
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