Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel...simple upper case conversion

Status
Not open for further replies.

jfhewitt

Technical User
Jun 6, 2000
287
US
Is there any reason why Excel does not allow for defining a cell, and switching the text to upper or lower case? Must it be so difficult? Any answers?
 
Dont know the reason why this is so, but...
if text is in A1, put =upper(a1) or =lower(a1) into B1 to convert. Fill down the column by double clicking on the fill handle.
 
This will allow you to toggle between Upper and lower:-

Sub ToggleCase()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

For Each cell In ActiveSheet.UsedRange
If cell.HasFormula = False And cell.Value = UCase(cell.Value) Then
cell.Value = LCase(cell.Value)
Else
cell.Value = UCase(cell.Value)
End If
Next cell
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub

Regards
Ken.................

----------------------------------------------------------------------------
[peace]It's easier to beg forgiveness than ask permission[2thumbsup]

----------------------------------------------------------------------------
 
Thanks Ken...perfecto! Now why can't the toggle be assigned a permanent button in Excel?
 
:)

----------------------------------------------------------------------------
[peace]It's easier to beg forgiveness than ask permission[2thumbsup]

----------------------------------------------------------------------------
 
Actually, I would like to change case in only the selected cell, not the whole sheet. How is that done?
 
Just change

For Each cell In ActiveSheet.UsedRange

to

For Each cell In Selection

Regards
Ken...............

----------------------------------------------------------------------------
[peace]It's easier to beg forgiveness than ask permission[2thumbsup]

----------------------------------------------------------------------------
 
Thanks again, Ken. My VBA skills are minimal, but I figured it was an easy fix.
 
LOL - You're welcome

Regards
Ken.............

----------------------------------------------------------------------------
[peace]It's easier to beg forgiveness than ask permission[2thumbsup]

----------------------------------------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top