Search This Blog

Friday, September 24, 2010

Excel VBA Macro for Upper Case Text Formatting




I find myself updating some documentation for the menu system I enhanced yesterday. While updating a spreadsheet, I spied the following vba macro. I thought you might find it handy for formatting selected cells.



Place the following in your "ThisWorkbook" module inside the vba editor.

Option Explicit

Sub Upper_Case()
'
' Upper_Case Macro
' Change Value of Selection to upper case
'
' Keyboard Shortcut: Ctrl+t
'
Dim myCell As Range
Set myCell = Application.ActiveCell
With myCell
.Select
.Value = UCase(.Text)
End With
End Sub

Then assign a shortcut to run the routine. (I use Ctrl+Shift+T) Then as you work in excel, you can select a cell that you want to format as upper case text and press your shortcut to reformat it.

...now back to work!

No comments: