Convert highlighted text within Excel 2016 to uppercase

What are the steps to convert highlighted text within Excel 2016 to uppercase?
IT GuyNetwork EngineerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongCommented:
try:

Sub test()
    Dim c As Range
    For Each c In Selection.Cells
        c = UCase(c.Text)
    Next
End Sub

Open in new window

0
IT GuyNetwork EngineerAuthor Commented:
Isn't there a way where the text can simply be highlighted and then a certain option of set of keystrokes are pressed which will automatically convert the text to all upper case?
0
Ryan ChongCommented:
try:

Private Sub Worksheet_Change(ByVal Target As Range)
    Dim c As Range
    For Each c In Target
        c = UCase(c.Text)
    Next
End Sub

Open in new window


the Text will auto convert to Uppercase once Enter was pressed or leave the cell
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Wayne Taylor (webtubbs)Commented:
Assign a shortcut key to the macro Ryan posted initially...

1) Press Alt+F8 to bring up the Macro dialog
2) Select the macro
3) Click Options
4) In the textbox under "Shortcut key:", assign the appropriate number.

Note - take care when assigning a key as it will override any default actions. Ideally, if you press Shift when entering your desired key, it should change to Ctrl+Shift+?.
0
Ryan ChongCommented:
I did some enhancement to my previous codes to below which seems worked better:

Private Sub Worksheet_Change(ByVal Target As Range)
    Dim c As Range
    For Each c In Target
        If IsEmpty(c.Value) = False Then c.Value = UCase(c.Value)
    Next
End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Andrew LeniartSenior EditorCommented:
Isn't there a way where the text can simply be highlighted and then a certain option of set of keystrokes are pressed which will automatically convert the text to all upper case?

No. You're thinking of Shift+F3 in Microsoft Word. Doesn't work in Excel.
0
Rob HensonFinance AnalystCommented:
You can also use the UPPER function, syntax:

=UPPER(Cell Ref)  where Cell Ref is cell containing the text to be converted.

This would be in a separate cell to the original but you can then copy and paste values into the source cell.

Likewise, for other text conversions:
=LOWER(text)   - converts text to all lower case
=PROPER(text) - converts text to lower case with upper case for the first letter of each word
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.