+ Reply to Thread
Results 1 to 9 of 9

Swap each cell two colours of the text

  1. #1
    Forum Contributor
    Join Date
    04-04-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    199

    Swap each cell two colours of the text

    I'm working on a worksheet where data is segmented into groups of different number of rows separated with one empty row.

    ColD has text data, where each cell's string has parts of red and black colours .. both are in the same one cell.

    I need to swap colours per each cell, so the red portion becomes black, and the black portion becomes red.

    Can I get some precious help with this quesion please?

    Many thanks in advance.

    T.

  2. #2
    Forum Guru Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2010 on Linux
    Posts
    11,135

    Re: Swap each cell two colours of the text

    Welcome to the forum

    Please attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Be very, very careful using IFERROR ! It hides ALL errors which is not always what you want to get correct results

  3. #3
    Forum Contributor
    Join Date
    04-04-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    199

    Re: Swap each cell two colours of the text

    at the beck and call .. : )
    actually I was preparing it while you posted your reply ..
    here it is ..
    Attached Files Attached Files

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,613

    Re: Swap each cell two colours of the text

    Let's start with this one.

    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  5. #5
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013
    Posts
    16,661

    Re: Swap each cell two colours of the text

    This only swap red & black and leave other remain the same if any other font color(s) are used.
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    04-04-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    199

    Re: Swap each cell two colours of the text

    Quote Originally Posted by bakerman2 View Post
    Let's start with this one.

    Please Login or Register  to view this content.
    Fantastic Bakerman2 .. you did it as exactly as it is desired .. I do thank you for your effort and time and, of course, the knowledge you spent to solve my problem. I will mark this issue as solved by this solution.
    Please accept my best personal regards ..
    T.

  7. #7
    Forum Contributor
    Join Date
    04-04-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    199

    Re: Swap each cell two colours of the text

    Quote Originally Posted by jindon View Post
    This only swap red & black and leave other remain the same if any other font color(s) are used.
    Please Login or Register  to view this content.
    I'm always grateful to you Jindon for your invaluable input that solved tens of my problems. But in fact, this solution did not swap colours .. it just changed the red to black, so the cell string became totally black instead of two original colours. it is true that the text could be returned as red by re running the code, but this is actually was not the desired solution.

    I do appreciate your code very much ..

    Thank you very much indeed ..

    T.

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013
    Posts
    16,661

    Re: Swap each cell two colours of the text

    Really?
    Very strange.
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    04-04-2013
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    199

    Re: Swap each cell two colours of the text

    I downloaded your attachment, and actually it is working perfect!!
    As I ran it on my original data, it did not swap both colours, it only swapped the red into black.

    I believe there's something unseen in the formatting that was produced by another script, so that the black is considered "automatic" instead of black .. I really don't know ..

    I think I have to do more testing with different data samples from the file.

    More than grateful to you Jindon .. thank you very much my dear ..

    T.

+ 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] Macro to swap numbers and text within a Cell
    By elgato74 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-23-2018, 03:34 PM
  2. Replies: 5
    Last Post: 09-28-2014, 06:17 PM
  3. Swap range of cells and keep background colours
    By desimck in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-16-2013, 03:51 PM
  4. Check Box to swap between having a formula in a cell and displaying text
    By anit999 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-11-2013, 04:59 AM
  5. [SOLVED] Swap text in a cell complication
    By alexxshadows in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 11-14-2012, 09:06 PM
  6. Trying to append text into a cell with different colours
    By Earl in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-16-2008, 05:23 PM
  7. [SOLVED] Excel 2003 font colours and cell colours
    By bretta in forum Excel General
    Replies: 1
    Last Post: 04-16-2005, 11:06 PM

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