+ Reply to Thread
Results 1 to 7 of 7

Trying to make a nice Title Case

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Trying to make a nice Title Case

    I'm using a macro I found at https://excelribbon.tips.net/T010560...ain_Words.html, to create a macro that will let me apply a good Title Case to selected cells. I'm trying to use Peter Atherton's solution from the bottom of the page (code shown below). The macro works well, with one exception, which I've since found out is a feature of the PROPER function, to wit, letters following apostrophe's are capitalized. The idea is that "o'leary" should convert to "O'Leary", but the problem is "Jim's" shouldn't convert to "Jim'S". I've looked and found a possible solution, the formula
    Please Login or Register  to view this content.
    , but I'm not sure how to plumb that into this function without losing all the other functionality I want to keep. Any help on this would be greatly appreciated.
    Please Login or Register  to view this content.
    I know I'm not stupid, but I suspect I'm a lot stupider than I think I am

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Trying to make a nice Title Case

    I would add code like so (insert red code after existing line of code):
    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Trying to make a nice Title Case

    The example you gave was 'S
    But are there not several more? Like: can'Nt, I'Ve, he'D etc

    Other than when it follows an unaccompanied O like O'Shannon, when would any letter following an apostrophe be capitalised?

    My example(O'Shannon) conflicts with the 'S rule
    - if all 'S converted to 's, then further code required to reinstate all of the O'Shannons etc to upper case
    Last edited by kev_; 01-19-2018 at 03:02 AM.
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  4. #4
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Trying to make a nice Title Case

    Kev,
    Your objections are mine as well. it can't be just S, 'cause then we'd have "Don'T", or "You'Ve". Seems like it might be a placement issue: if it's in the back half of the word, make it lowercase, but if it's in the front half it should be capitalized.

    Actual names from my database of 15K people that would cause trouble.
    Triciana La'Chelle
    La'Shondria Shantille
    De'a Rane
    Di'Jon

    Words that PROPER violates:
    Don'T
    He'S
    Wouldn'T
    I'Ve
    He'D
    She'D
    Last edited by jomili; 01-18-2018 at 06:31 PM.

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Trying to make a nice Title Case

    You can develop an algorithm that covers dictionary word contractions but you'll never have an algorithm that knows the difference between La'Shondria Shantille and De'a Rane.

  6. #6
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Trying to make a nice Title Case

    Function LateAdjustments is now called from your original function (see below for minor amendment)
    - I would rather not change the original function

    This should get you close
    - you can add more replacements
    - but think through any consequences fully!!
    - the sequence may be critical
    - I have ignored your list of difficulat names most will be correct already
    - De'a Rane Replace "De'A " with De'a " (note that the final character is a space)

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  7. #7
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,952

    Re: Trying to make a nice Title Case

    Kev,
    Sorry it took me so long to get back. I was off work Friday and the weekend, so just getting back. I tried your solution and it rocks! As 6String Jazzer pointed out, I'll never have a 100% solution, but your methodology brings me really close. Plus, it allows me flexibility to add more criteria if needed. the only one I've added so far is Re as in "They're".
    Please Login or Register  to view this content.
    Thank you so much!

    I've added my full Formatting macro below in case anyone else wants to use it. Any tips on making it more compact would be appreciated. BTW, Speedon and Speedoff are just separate subs I've made for turning calculation, screenupdating, etc. off and on.
    Please Login or Register  to view this content.

+ 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. Make Upper Case in cells become lower case
    By davidx in forum Excel General
    Replies: 2
    Last Post: 12-02-2013, 08:40 AM
  2. Replies: 7
    Last Post: 11-08-2012, 03:06 PM
  3. Auto change column to Title Case
    By Zyphon in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-08-2008, 11:18 AM
  4. How can I force Title Case in a cell?
    By Zyphon in forum Excel General
    Replies: 8
    Last Post: 01-29-2008, 09:22 AM
  5. making text in Title Case automatically
    By tweety127 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-09-2006, 07:10 PM
  6. [SOLVED] Title case for text in columns
    By Annalise Vogel in forum Excel General
    Replies: 3
    Last Post: 12-08-2005, 12:50 AM
  7. [SOLVED] Title Case--No mail merge
    By Derek Y via OfficeKB.com in forum Excel General
    Replies: 3
    Last Post: 07-29-2005, 03:05 PM
  8. Change case from UPPER to Title Case??
    By Mamacsee in forum Excel General
    Replies: 2
    Last Post: 07-05-2005, 05:05 PM

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