V
Voodoodan
Hiya,
I've modified a bit of code, below, so that if someone types anythin
into cell C25, then it capitalises the first letter.
Is there any way of modifying it a little bit more so that, as well a
the above, if someone types in a 3-letter word then it capitalises al
three letters?
So, if I enter 'daniel', it returns 'Daniel'. If I enter 'dan' i
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
I've modified a bit of code, below, so that if someone types anythin
into cell C25, then it capitalises the first letter.
Is there any way of modifying it a little bit more so that, as well a
the above, if someone types in a 3-letter word then it capitalises al
three letters?
So, if I enter 'daniel', it returns 'Daniel'. If I enter 'dan' i
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