+ Reply to Thread
Results 1 to 10 of 10

Change text color of a range of cell

  1. #1
    Registered User
    Join Date
    10-23-2014
    Location
    Malaysia
    MS-Off Ver
    MS2013
    Posts
    30

    Change text color of a range of cell

    Hi guys, I'm developing an excel spreadsheet and I would like to add some conditional formatting to the cell text color. I would like to change the text color from range("n8:n219") and range("p8:p219") based on range("r8:r219") value. for each cell in range("r8:r219") if the value =0, the text color of range("n8:n219") and range("p8:p219") would be cell.font.colorindex=2, else the text color would be cell.font.colorindex=1. I wrote a draft but it cant seems to work can anyone help on this?

    Please Login or Register  to view this content.
    Thanks and Regards,
    KB
    Last edited by keby1nko; 11-07-2014 at 10:50 PM.

  2. #2
    Forum Contributor
    Join Date
    10-30-2013
    Location
    Melbourne
    MS-Off Ver
    Excel 2013
    Posts
    173

    Re: Change text color of a range of cell

    Why don't you use conditional formatting?


    Sent from my iPad using Tapatalk

  3. #3
    Registered User
    Join Date
    10-23-2014
    Location
    Malaysia
    MS-Off Ver
    MS2013
    Posts
    30

    Re: Change text color of a range of cell

    I'm not actually very familiar with conditional formatting for such case, as the value in Range("R8:R219") will be keep changing depending on the type of item selected.

    So I believe that by using VBA i can obtain the result faster. =)

  4. #4
    Forum Contributor
    Join Date
    10-30-2013
    Location
    Melbourne
    MS-Off Ver
    Excel 2013
    Posts
    173

    Re: Change text color of a range of cell

    This is very easy to do with standard CF. But ok. Check this out... http://msdn.microsoft.com/en-us/libr...ffice.15).aspx


    Sent from my iPad using Tapatalk

  5. #5
    Registered User
    Join Date
    10-23-2014
    Location
    Malaysia
    MS-Off Ver
    MS2013
    Posts
    30

    Re: Change text color of a range of cell

    Thanks coolblue,

    I would elaborate more into my problem, this is what contain in Cell N
    Please Login or Register  to view this content.
    and this is what contain in cell P
    Please Login or Register  to view this content.
    where there is no selection of item in cell B12 and D12, both cell N and P would appear as #REF! error, and when the user wish to print the list out, the #REF! error retain and I was thinking of using cell R as a reference cell (as the final result is being tabulated in cell R) to change the font color of cell N and P.

    Can this be applied by using standard CF as well?

  6. #6
    Forum Contributor
    Join Date
    10-30-2013
    Location
    Melbourne
    MS-Off Ver
    Excel 2013
    Posts
    173

    Re: Change text color of a range of cell

    Upload your spreadsheet and I'll have a quick look at it...


    Sent from my iPhone using Tapatalk

  7. #7
    Registered User
    Join Date
    10-23-2014
    Location
    Malaysia
    MS-Off Ver
    MS2013
    Posts
    30

    Re: Change text color of a range of cell

    My spreadsheet look something like this with a longer list

    Font.xlsx

  8. #8
    Forum Contributor
    Join Date
    10-30-2013
    Location
    Melbourne
    MS-Off Ver
    Excel 2013
    Posts
    173

    Re: Change text color of a range of cell

    I made the colour red, not 2, so you can see it but you can change it in the conditional format.
    Using merged cells in your table body is a very bad idea by the way...
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    10-23-2014
    Location
    Malaysia
    MS-Off Ver
    MS2013
    Posts
    30

    Re: Change text color of a range of cell

    I wish not to include the merged cell as well, but im in a rush and im editing based on the company existing formatting for the past.

    But thank you very much for pointing it out! =)

  10. #10
    Forum Contributor
    Join Date
    10-30-2013
    Location
    Melbourne
    MS-Off Ver
    Excel 2013
    Posts
    173

    Re: Change text color of a range of cell

    Can you access the CF ok? Just use the shortcut Alt-O-D


    Sent from my iPhone using Tapatalk

+ 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. Change a Range's cell background color to that of another cell's cond. format color
    By kamelkid2 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-31-2014, 12:57 PM
  2. Macro to change cell text color based on darkness of cell fill color
    By cincyshirm61 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-25-2014, 12:11 PM
  3. [SOLVED] vba code to change the cell color by looking in a range that contains the color index valu
    By ckklconner in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-24-2013, 09:15 AM
  4. VBA to change font color of range of cells based on text not in another cell
    By tk31271 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-30-2013, 09:36 AM
  5. change text color based on adjacent cell text color
    By matthewst in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-01-2005, 03:49 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