+ Reply to Thread
Results 1 to 8 of 8

VBA - auto uppercase does not allow multi color text

  1. #1
    Forum Contributor
    Join Date
    04-05-2013
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    360

    VBA - auto uppercase does not allow multi color text

    i'm using the following code to make all text uppercase. However i also want to be able to have different color text in 1 cell.

    For instance i may 'A B C' in cell A1. I when i try to make A red i turns back to black. can i change this?

    Please Login or Register  to view this content.
    Last edited by adamheon; 10-02-2013 at 12:58 PM.

  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,696

    Re: VBA - auto uppercase does not allow multi color text

    Formatting of individual characters within a cell are tied to the character. That is, if you have

    abc

    and uppercase it, you are changing the characters and therefore the formatting for the new contents reverts to the default.

    ABC

    The way to do what you want is to add code to create the formatting you want. Will you always have the same formatting in each cell? That is, is the first character always red? Or is it different from cell to cell? If it's always the same you can write code to do that. If it's different, you have to write code to determine what formatting is used, then change the text, then re-apply that formatting.

    I can help with this but would prefer to get all the details before I start giving you code.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    04-05-2013
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    360

    Re: VBA - auto uppercase does not allow multi color text

    Thanks for the reply.

    What I would want is the last letter to be white in specific cells.

    This would not apply to every cell but in certain cells that i choose. Thanks for the help!

  4. #4
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: VBA - auto uppercase does not allow multi color text

    What is the criteria for the cells that have the last letter changed?

    Perhaps using an IF to check if the contents are in UCase format to prevent iteration.

    This way if you do change the contents after the fact, the Worksheet_Change doesn't kick off again on that cell and instantly reapply default formatting.

  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,696

    Re: VBA - auto uppercase does not allow multi color text

    This modifies your existing code to change the last character to white font. You need to add an If statement that specifies the certain cells you choose.

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    04-05-2013
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    360

    Re: VBA - auto uppercase does not allow multi color text

    Great thanks. could you show me an example of an IF statement that would specify a cell? (i'm still new to code and IF formulas)

  7. #7
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: VBA - auto uppercase does not allow multi color text

    You may change the text without changing the format:
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    04-05-2013
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    360

    Re: [SOLBED] VBA - auto uppercase does not allow multi color text

    Thank you. Works great. I have another issue but i will start a new thread.

+ 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. Replies: 0
    Last Post: 03-12-2013, 04:29 PM
  2. How to auto uppercase till last row.
    By RonaldRS in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-28-2012, 11:18 AM
  3. Excel 2007 : Auto Uppercase on closing
    By Speculati0n in forum Excel General
    Replies: 2
    Last Post: 09-21-2011, 09:50 AM
  4. Convert lowercase text to uppercase text in Excel
    By mls_newbee in forum Excel General
    Replies: 1
    Last Post: 09-22-2010, 01:14 PM
  5. How to auto change text color/font when another line =
    By Blacryan in forum Excel General
    Replies: 3
    Last Post: 05-17-2007, 01:30 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