Have you ever needed to change the case of text in selected cells within an Excel spreadsheet? After searching the Internet, I found something close then modified it to meet my needs. Others may need to do the same so here is the macro that I ended up with.
Sub Change_Case()
Dim ocell As Range
Dim Ans As String
Ans = Application.InputBox("Type in Letter" & vbCr & _
"(L)owercase, (U)ppercase, (S)entence, (T)itles ")
If Ans = "" Then Exit Sub
If TypeName(Selection) <> "Range" Then Exit Sub
For Each ocell In Selection
Select Case UCase(Ans)
Case "L": ocell = LCase(ocell.Text)
Case "U": ocell = UCase(ocell.Text)
Case "S": ocell = UCase(Left(ocell.Text, 1)) & _
LCase(Right(ocell.Text, Len(ocell.Text) - 1))
Case "T": ocell = Application.WorksheetFunction.Proper(ocell.Text)
End Select
Next
End Sub
I only needed it to force all upper or all lower case. I have not tested the other options so use it at your own risk.
LEGO Star Wars Millennium Falcon Joins Early Prime Day Deal, and It’s a
25th Anniversary Collectible Model
-
[image: Lego Star Wars Millennium Falcon A New Hope 25th Anniversary
Collectable Model]
LEGO's celebration of 25 years of making incredible Star Wars build...
12 minutes ago
No comments:
Post a Comment