+ Reply to Thread
Results 1 to 3 of 3

Capital each word excluding “and” in the post code column all letters in upper case

Hybrid View

  1. #1
    Registered User
    Join Date
    04-19-2012
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    18

    Capital each word excluding “and” in the post code column all letters in upper case

    What I would like to achieve is capitalise to each word, but exclude the “and” word and in the post code column all the letters in upper case. I got the code from the net it is not doing what I want
    As per sample: Mr and Mrs, not, Mr And Mrs
    Post code: RE11 1WP, not, Re11 1Wp
    Attached Files Attached Files

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Capital each word excluding “and” in the post code column all letters in upper case

    For columnd B:D a formula like

    Formula: copy to clipboard
    =SUBSTITUTE(PROPER(B3),"And","and")


    or even change and to & with
    Formula: copy to clipboard
    =SUBSTITUTE(B3,"And","&")


    and for column L
    Formula: copy to clipboard
    =UPPER(L3)
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    04-19-2012
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: Capital each word excluding “and” in the post code column all letters in upper case

    This is the code I used to make capital each word, but I want to exclude “and” and in column “L” all upper case. So I would appreciate if someone can modify this code to exclude “and” also upper case in column L.
    Thank you all and merry Christmas and Happy New Year


    Private Sub Worksheet_Change(ByVal Target As Range)
    Const WS_RANGE As String = "A1:P200"
    
    On Error GoTo ws_exit:
    Application.EnableEvents = False
    If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
    With Target
    If Not IsNumeric(.Value) Then
    If Not .HasFormula Then
    .Value = Application.PROPER(.Value)
    End If
    UPPER (L3)
    End If
    SUBSTITUTE(PROPER(B3),"And","and")
    
    End With
    End If
    
    ws_exit:
    Application.EnableEvents = True
    End Sub
    Last edited by jeffreybrown; 12-25-2018 at 09:57 AM. Reason: Please use code tags!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Not differentiating between capital letters and lower case letters
    By Eliot Y in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-22-2015, 11:13 AM
  2. Replies: 10
    Last Post: 01-20-2014, 10:09 AM
  3. Replies: 11
    Last Post: 01-18-2014, 12:56 PM
  4. [SOLVED] Mass changing upper case to lower case letters
    By jonathan.haynes in forum Excel Formulas & Functions
    Replies: 28
    Last Post: 09-05-2012, 04:34 PM
  5. Change lower case letters to upper case
    By SkeeterDon in forum Excel General
    Replies: 2
    Last Post: 10-28-2010, 11:05 AM
  6. making lower case letters capital
    By hollandrob81 in forum Excel General
    Replies: 2
    Last Post: 11-12-2008, 09:12 AM
  7. [SOLVED] Can I change upper case letters to down case automatically?
    By Sirritys in forum Excel General
    Replies: 8
    Last Post: 07-04-2006, 09:35 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1