View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Gord Dibben[_2_] Gord Dibben[_2_] is offline
external usenet poster
 
Posts: 621
Default Capitalise on Input Q

In Col C & D capitalise the first letter that the user inputs

Change both the 2's to 1 in this part of Don's code.

Target.Value = UCase(Left(Target, 2)) & _
Right(Target, Len(Target) - 2)



Gord Dibben MS Excel MVP

On Sun, 5 Dec 2010 06:12:59 -0800 (PST), Don Guillett Excel MVP
wrote:

In Col C & D capitalise the first letter that the user inputs

Thanks

Right click the sheet tabview codeinsert this.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If Target.Column = 2 Then
Application.EnableEvents = False
fd = InStr(Target, "-")
ms = Left(Target, fd) & UCase(Mid(Target, fd + 1, 2)) _
& Mid(Target, fd + 3, 256)
Target = ms
Application.EnableEvents = True
End If
If Target.Column = 3 or target.column=4 Then
Application.EnableEvents = False
Target.Value = UCase(Left(Target, 2)) & _
Right(Target, Len(Target) - 2)
End If
Application.EnableEvents = True
End Sub