+ Reply to Thread
Results 1 to 6 of 6

Capitalising letters after . or ? or !

  1. #1
    Registered User
    Join Date
    11-02-2012
    Location
    Leeds, England
    MS-Off Ver
    Excel 2007
    Posts
    6

    Capitalising letters after . or ? or !

    Hi

    The problem I'm currently having is that I want my macro to capitalise a letter that comes after the end of any sentence - at the minute it only capitalises a letter if it comes after a full stop (period for any americans reading!). Essentially what I want is to turn

    this sentence isn't written properly. why not? people can't be bothered to press shift! it's annoying.

    into

    This sentence isn't written properly. Why not? People can't be bothered to press shift! It's annoying.

    The part I've highlighted in red is the part that currently puts a capital letter after a full stop. I'm new to VBA but I'm now thinking that as well as needing ? and ! adding in, the way it's been done is definitely not the most efficient? Am I right? I've found a couple of things similar on other forums e.g:

    http://stackoverflow.com/questions/1...case-using-vba

    http://www.vbforums.com/showthread.p...-each-sentence

    But nothing seems to do exactly what I want which is to change this text in the original cell. I've tried using trial and error to fix some codes that do similar things but nothing seems to work - I can get them to run eventually without an error but they either just delete all the text out or do nothing.

    Please Login or Register  to view this content.
    Any help would be really appreciated!

    I tried to replace it with the code from the stackoverflow forum removing the bit about the message box

    Please Login or Register  to view this content.
    But currently it just doesn't do anything.

    Thanks

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,607

    Re: Capitalising letters after . or ? or !

    See if this works:
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    11-02-2012
    Location
    Leeds, England
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Capitalising letters after . or ? or !

    Works perfectly! Thanks so much!

  4. #4
    Forum Contributor
    Join Date
    06-16-2011
    Location
    London
    MS-Off Ver
    Excel XP
    Posts
    276

    Re: Capitalising letters after . or ? or !

    <Pedantic nitpicking hat on> If you want to be really accurate then all stop characters like . ? or ! should have a double space after them before the capital letter.

  5. #5
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,607

    Re: Capitalising letters after . or ? or !

    I'd say I was pretty pedantic about such things, but I don't agree. I think it's a matter of opinion, but the trend nowadays is for a single space.

  6. #6
    Forum Contributor
    Join Date
    06-16-2011
    Location
    London
    MS-Off Ver
    Excel XP
    Posts
    276

    Re: Capitalising letters after . or ? or !

    My Mother the typesetter (God rest her soul) would disagree that it's a trend, she'd say a single space is just plain wrong. As for me, I'm a good boy who does what his Mother tells him.

+ 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] Reading the last 2 letters in a combobox value and enter those 2 letters into column
    By emilyloz in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-26-2013, 09:26 AM
  2. Replies: 5
    Last Post: 12-30-2012, 10:59 AM
  3. Replies: 2
    Last Post: 12-01-2010, 02:29 PM
  4. Replies: 9
    Last Post: 07-15-2010, 08:54 PM
  5. [SOLVED] Capitalising text
    By Winsome in forum Excel General
    Replies: 5
    Last Post: 03-14-2005, 07:06 AM

Tags for this Thread

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