Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
I use the following code to automatically change the case of a range of cells
to uppercase in Excel, which works fine. However I need some other cells in the same sheet to automatically change to Proper Case. Is there a way of adapting the following code to enable upper and proper case? Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo ws_exit: Application.EnableEvents = False If Not Intersect(Target, Range("H1,M5,O11,F7")) Is Nothing Then With Target .Value = UCase(.Value) End With End If ws_exit: Application.EnableEvents = True End Sub |
#2
![]() |
|||
|
|||
![]()
One way:
Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo ws_exit: Application.EnableEvents = False If Not Intersect(Target, Range("H1,M5,O11,F7")) Is Nothing Then With Target .Value = UCase(.Value) End With ElseIf Not Intersect(Target, Range("A1,B2,J10")) Is Nothing Then With Target .Value = Application.Proper(.Value) End With End If ws_exit: Application.EnableEvents = True End Sub In article , "John Davies" wrote: I use the following code to automatically change the case of a range of cells to uppercase in Excel, which works fine. However I need some other cells in the same sheet to automatically change to Proper Case. Is there a way of adapting the following code to enable upper and proper case? Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo ws_exit: Application.EnableEvents = False If Not Intersect(Target, Range("H1,M5,O11,F7")) Is Nothing Then With Target .Value = UCase(.Value) End With End If ws_exit: Application.EnableEvents = True End Sub |
#3
![]() |
|||
|
|||
![]()
Hi JE McGimspey
That works fine. Thanks for your help "John Davies" wrote: I use the following code to automatically change the case of a range of cells to uppercase in Excel, which works fine. However I need some other cells in the same sheet to automatically change to Proper Case. Is there a way of adapting the following code to enable upper and proper case? Private Sub Worksheet_Change(ByVal Target As Range) On Error GoTo ws_exit: Application.EnableEvents = False If Not Intersect(Target, Range("H1,M5,O11,F7")) Is Nothing Then With Target .Value = UCase(.Value) End With End If ws_exit: Application.EnableEvents = True End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
I NEED HELP with the SPELLNUMBER Function | Excel Worksheet Functions | |||
How do I change the case of text | New Users to Excel | |||
Change Case button? | Excel Discussion (Misc queries) | |||
Is there a formula to spell out a number in excel? | Excel Worksheet Functions | |||
Convert Numeric into Text | Excel Worksheet Functions |