ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Capital letters in names written by lower case (https://www.excelbanter.com/excel-programming/347285-capital-letters-names-written-lower-case.html)

vv

Capital letters in names written by lower case
 
I am writing names very often. It would be nice to write them with lower
case. Of course I need first letter of name Capital immediately after
leaving cell by TAB key. Is it possible to do it some way? Many thanks for
help. Excel and English beginner Vladi from Prague.



Gord Dibben

Capital letters in names written by lower case
 
vv

You can use event code in the worksheet.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Column 8 Then Exit Sub
On Error GoTo ErrHandler
Application.EnableEvents = False
Target.Formula = Application.Proper(Target.Formula)
ErrHandler:
Application.EnableEvents = True
End Sub

As written, operates on columns A:H. Change the 8 to your choice.

Copy this code then right-click on your sheet tab and "View Code"

Paste into that module.


Gord Dibben Excel MVP

On Sun, 4 Dec 2005 20:36:03 +0100, "vv" <microsoft.public.cs.desktop wrote:

I am writing names very often. It would be nice to write them with lower
case. Of course I need first letter of name Capital immediately after
leaving cell by TAB key. Is it possible to do it some way? Many thanks for
help. Excel and English beginner Vladi from Prague.


Bob Phillips[_6_]

Capital letters in names written by lower case
 
Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H1:H10"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
.Value = Application.Proper(.Value)
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"vv" <microsoft.public.cs.desktop wrote in message
...
I am writing names very often. It would be nice to write them with lower
case. Of course I need first letter of name Capital immediately after
leaving cell by TAB key. Is it possible to do it some way? Many thanks for
help. Excel and English beginner Vladi from Prague.





Greg Wilson

Capital letters in names written by lower case
 
Assuming the column that you enter names is column A then paste to the
worksheet code module:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If Len(Target.Value) = 0 Then Exit Sub
If Target.Column = 1 Then Target.Value = _
StrConv(Target.Value, vbProperCase)
End Sub

Regards,
Greg


"vv" wrote:

I am writing names very often. It would be nice to write them with lower
case. Of course I need first letter of name Capital immediately after
leaving cell by TAB key. Is it possible to do it some way? Many thanks for
help. Excel and English beginner Vladi from Prague.




Greg Wilson

Capital letters in names written by lower case
 
Change to:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If Len(Target.Value) = 0 Then Exit Sub
Application.EnableEvents = False
If Target.Column = 1 Then Target.Value = _
StrConv(Target.Value, vbProperCase)
Application.EnableEvents = True
End Sub

Regards,
Greg


"Greg Wilson" wrote:

Assuming the column that you enter names is column A then paste to the
worksheet code module:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If Len(Target.Value) = 0 Then Exit Sub
If Target.Column = 1 Then Target.Value = _
StrConv(Target.Value, vbProperCase)
End Sub

Regards,
Greg


"vv" wrote:

I am writing names very often. It would be nice to write them with lower
case. Of course I need first letter of name Capital immediately after
leaving cell by TAB key. Is it possible to do it some way? Many thanks for
help. Excel and English beginner Vladi from Prague.




Tom Ogilvy

Capital letters in names written by lower case
 
Right click on the sheet tab, select view code, then paste in code like this

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

Change 3 to the column where you want this to occur.

--
Regards,
Tom Ogilvy

"vv" <microsoft.public.cs.desktop wrote in message
...
I am writing names very often. It would be nice to write them with lower
case. Of course I need first letter of name Capital immediately after
leaving cell by TAB key. Is it possible to do it some way? Many thanks for
help. Excel and English beginner Vladi from Prague.






All times are GMT +1. The time now is 01:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com