Excel User Group
Microsoft Excel blogs, forums, files. Read, ask questions, provide answers.

'clear' formatting of text - vbUpperCase etc.

Latest post Wed, Jun 16 2010 10:31 AM by David B. 2 replies.
  • Tue, Jun 15 2010 2:32 PM

    • David B
    • Top 50 Contributor
    • Joined on Thu, Aug 14 2008
    • Posts 15
    • Points 219

    'clear' formatting of text - vbUpperCase etc.

    Hi All,

     

    I've been using VBA to play with text in a cell.  Basically I needed to change individual characters to be uppercase, lowercase, subscripted etc.

    I think I have that sorted now but whilst playing around I tried using the StrConv vbUpperCase,  vbLowerCase & vbProperCase functions, which has taken me down a garden path..   and now for completeness I'm struggling with how to 'clear' the cell of all formatting instructions such as vbPropercase etc. so that the user can enter text and it appear as typed.. i.e. if they type 'HEllo WOrld' that's what you get... rather than Excel formatting it for you...

    Anyone know how to do this?

     

    Cheers in advance!

     

    Filed under: , ,
    • Post Points: 21
  • Tue, Jun 15 2010 4:09 PM In reply to

    • Nick Hodge
    • Top 10 Contributor
    • Joined on Sun, Dec 23 2007
    • Southampton
    • Posts 543
    • Points 9,287
    • MVP

    Re: 'clear' formatting of text - vbUpperCase etc.

    David

    In general Excel formats according to two things. It's 'numbers' engine that recognises, for example (and sometimes annoyingly), dates typed as (in UK) 01/01/1997 and those options in the autocorrect listing like 'Correct Caps lock On', etc.

    There should be nothing you will have done in VBA that will be 'stuck' unless you have it within some event or another that is acting on an action in the UI.

    If I'm wide of the mark here you will need to explain in greater detail or post the code you have

    Regards
    Nick Hodge
    Microsoft MVP, Excel
    Southampton, UK

    • Post Points: 21
  • Wed, Jun 16 2010 10:31 AM In reply to

    • David B
    • Top 50 Contributor
    • Joined on Thu, Aug 14 2008
    • Posts 15
    • Points 219

    Re: 'clear' formatting of text - vbUpperCase etc.

    Hi Nick, thanks for the reply.

    Having looked back at what I was doing I've realised I was being just a little stupid - The text formatting was being triggered by a separate Sub Worksheet_Change routine I had been playing with.  Once removed all is well again :-)

     

    Thanks for taking the time to reply etc.

     

    Cheers

    • Post Points: 5
Page 1 of 1 (3 items) | RSS
Copyright Excel User Group and the relevant contributors, 2010. All Trade Marks acknowledged. This site is a peer-to-peer site and NOT affiliated in any way to Microsoft Corp. All rights reserved.