Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to write some code that will always change Text once entered to
the proper case. The text in question is First Name, Last Name (entered in cells O7:O24). I am using the following but am getting an error. What am I doing wrong? Private Sub Worksheet_Change(ByVal Target As Excel.Range) With Target If .Count = 1 Then If Not Intersect(.Cells, Range("O7:O24")) Is Nothing Then Application.EnableEvents = False .Value = Proper(.Value) Application.EnableEvents = True End If End If End With End Sub Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
Proper is a worksheet function, not a VBA function. Private Sub Worksheet_Change(ByVal Target As Excel.Range) With Target If .Count = 1 Then If Not Intersect(.Cells, Range("O7:O24")) Is Nothing Then Application.EnableEvents = False .Formula = StrConv(.Formula, vbProperCase) Application.EnableEvents = True End If End If End With End Sub (I've changed .value to .formula to allow formula entries in the cells. Change back if it's unwanted.) HTH. Best wishes Harald "John" skrev i melding ... I am trying to write some code that will always change Text once entered to the proper case. The text in question is First Name, Last Name (entered in cells O7:O24). I am using the following but am getting an error. What am I doing wrong? Private Sub Worksheet_Change(ByVal Target As Excel.Range) With Target If .Count = 1 Then If Not Intersect(.Cells, Range("O7:O24")) Is Nothing Then Application.EnableEvents = False .Value = Proper(.Value) Application.EnableEvents = True End If End If End With End Sub Thanks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Harald, works perfectly
"Harald Staff" wrote in message ... Hi Proper is a worksheet function, not a VBA function. Private Sub Worksheet_Change(ByVal Target As Excel.Range) With Target If .Count = 1 Then If Not Intersect(.Cells, Range("O7:O24")) Is Nothing Then Application.EnableEvents = False .Formula = StrConv(.Formula, vbProperCase) Application.EnableEvents = True End If End If End With End Sub (I've changed .value to .formula to allow formula entries in the cells. Change back if it's unwanted.) HTH. Best wishes Harald "John" skrev i melding ... I am trying to write some code that will always change Text once entered to the proper case. The text in question is First Name, Last Name (entered in cells O7:O24). I am using the following but am getting an error. What am I doing wrong? Private Sub Worksheet_Change(ByVal Target As Excel.Range) With Target If .Count = 1 Then If Not Intersect(.Cells, Range("O7:O24")) Is Nothing Then Application.EnableEvents = False .Value = Proper(.Value) Application.EnableEvents = True End If End If End With End Sub Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Cannot change text to proper case using formula | Excel Worksheet Functions | |||
trying to change Proper function results to text? | Excel Worksheet Functions | |||
How do I change text to proper when text is already in upper? | New Users to Excel | |||
How can I change text to proper text in multiple cells. | Excel Discussion (Misc queries) | |||
How do I change all cells to Proper text in Excel | Excel Worksheet Functions |