+ Reply to Thread
Results 1 to 6 of 6

find text colour of current cell

  1. #1
    Registered User
    Join Date
    09-30-2010
    Location
    pass
    MS-Off Ver
    Excel 2003
    Posts
    3

    find text colour of current cell

    Hi,

    I'm using Excel 2003.

    I'm writing a vba macro and I'm trying to identify the font colour of a cell.
    I want to know what colour is currently visible in the cell.

    Below I'm checking to see if the current cell has a font colour of 41 (blue).

    If Selection.Font.ColorIndex = 41 Then

    This works on a cell without conditional formatting, but doesn't work on a cell with conditional formatting.


    So, I tried this then realised, it doesn't tell me what colour is visable, it tells me what colour it would be if the 1st conditional formatting rule was true.

    If Selection.FormatConditions(1).Font.ColorIndex = 41 Then


    Can anyone please tell me what the code should be?

    thanks

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: find text colour of current cell

    perhaps worth having a read through of: http://www.cpearson.com/excel/CFColors.htm

  3. #3
    Registered User
    Join Date
    09-30-2010
    Location
    pass
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: find text colour of current cell

    Hi,

    Thanks for the link DonkeyOte,
    I think I can do what I need now - many thanks

  4. #4
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: find text colour of current cell

    If you need to use Excel 2007, there are more problems with graded colours.

    Have a look at this thread to get an idea of what they might be.

    http://www.excelforum.com/excel-2007...r-scale-2.html

    Your profile indicates 2003 but it will do no harm to have a look.

  5. #5
    Registered User
    Join Date
    09-30-2010
    Location
    pass
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: find text colour of current cell

    Hi Marcol,

    Thanks for the reply, could be useful - thanks

  6. #6
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: find text colour of current cell

    Please Login or Register  to view this content.
    or as a function:

    Please Login or Register  to view this content.
    Last edited by snb; 10-01-2010 at 09:36 AM.



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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