Results 1 to 2 of 2

Thread: Vba Code to Change Case

  1. #1

    Vba Code to Change Case



    Register for a FREE account, and/
    or Log in to avoid these ads!

    Hi there. I'd like to add a code to an Excel spreadsheet so that when users enter data in a certain range ("E3:E25"), the data changes to Title Case regardless of what they enter. I don't want to use data validation rules in the cells or have to run a macro after data is entered. All the coding I could think of would apply to the entire worksheet but I need to limit it to these cells.

    Thanks

  2. #2
    Add this to the worksheet code module

    Code:
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    
    
        On Error GoTo ws_exit
        
        Application.EnableEvents = False
        
        If Not Intersect(Target, Me.Range("E3:E25")) Is Nothing Then
        
            Target.Value = Application.Proper(Target.Value)
        End If
    
    
    ws_exit:
        Application.EnableEvents = True
    End Sub

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •