Thread: changing case
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Shailesh Shah[_2_] Shailesh Shah[_2_] is offline
external usenet poster
 
Posts: 114
Default changing case

Hi Jeff,

Try this,

This will Change Text as under

Lower case to UPPERCASE
UPPERCASE to Title Case
Title Case to lowercase

Sub SelectCase()
'Assign Shortcut key
Dim C As Range, rng As Range, cc As Integer
If Selection.Count = 1 Then
Set rng = Selection.SpecialCells(xlCellTypeConstants).Cells
Else
Set rng = Selection
End If
Set C = rng(1)
Select Case True
Case C = LCase(C)
cc = 1
Case C = UCase(C)
cc = 2
Case Else
cc = 3
End Select
Application.EnableCancelKey = xlErrorHandler
On Error GoTo xit
Application.EnableEvents = 0
For Each C In rng
With C
.Formula = Choose(cc, UCase(.Formula),
Application.Proper(.Formula), LCase(.Formula))
End With
Next C
xit:
Application.EnableEvents = 1
End Sub


For a free add-ins download from below site.

Regards,
Shah Shailesh
http://members.lycos.co.uk/shahweb/


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!