View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Voodoodan
 
Posts: n/a
Default 3 letter capitalisation


Hiya,

I've modified a bit of code, below, so that if someone types anything
into cell C25, then it capitalises the first letter.

Is there any way of modifying it a little bit more so that, as well as
the above, if someone types in a 3-letter word then it capitalises all
three letters?

So, if I enter 'daniel', it returns 'Daniel'. If I enter 'dan' it
returns 'DAN'.


Private Sub Worksheet_Change(ByVal Target As Excel.Range)

On Error GoTo ErrHandler
If Target.Count = 1 And Target.Column = 3 Then
Application.EnableEvents = False
sStr = Target.Value
Target.Value = UCase(Left(sStr, 1)) & LCase( _
Mid(sStr, 2))
End If
ErrHandler:
Application.EnableEvents = True
End Sub


Many thanks,
Dan.


--
Voodoodan
------------------------------------------------------------------------
Voodoodan's Profile: http://www.excelforum.com/member.php...nfo&userid=597
View this thread: http://www.excelforum.com/showthread...hreadid=505301