Use a Macro to Change Case to Upper, Lower, or Proper


November 12, 2021 - by

Use a Macro to Change Case to Upper, Lower, or Proper

Problem: Microsoft Word offers a command to convert text to UPPER or lower case. How can you do that in Excel?

Strategy: While you could add a new column with =UPPER(), =LOWER(), or =PROPER(), these three macros will make it easy to change the case for all of the selected cells.


Sub ApplyLowerCase()
	For Each cell In Selection
		cell.Value = LCase(cell.Value)
	Next cell
End Sub

Sub ApplyUpperCase()
	For Each cell In Selection
		cell.Value = UCase(cell.Value)
	Next cell
End Sub

Sub ApplyProperCase()
	Set WF = Application.WorksheetFunction
	For Each cell In Selection
		cell.Value = WF.Proper(cell.Value)
	Next cell
End Sub

See "Create a Personal Macro Workbook" for how to use these macros.




This article is an excerpt from Power Excel With MrExcel

Title photo by Jeremy Kwok on Unsplash