Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Microsoft: Office FAQ

Best of Excel

How can I find colored cells? by SkipVought
Posted: 29 May 07 (Edited 29 May 07)

The short answer is, you can't!

Where you can enter a formula and determine if a cell contains a certain value, there is no forumla that can do a similar thing for a certain format.

However, all is not lost.  Help is on the way! This is a User Define Function (UDF) that can return a string, reflecting the cell interior color for the colors Red, Blue, Green, Yellow, White, Black, Magenta &  Cyan.

Paste it in a Module.  It would be good to put it in your PERSONAL.XLS workbook.  Then, use it like any other function on your worksheet like this...

=IF(WhatInteriorColor(A1)="Red","I got RED!","nada")


Function WhatInteriorColor(rng As Range) As String
'Skip Metzger - 2007 May 29
'this function returns the color of the interior of a given cell
    Select Case rng.Interior.Color
        Case vbBlack
            WhatInteriorColor = "Black"
        Case vbRed
            WhatInteriorColor = "Red"
        Case vbGreen
            WhatInteriorColor = "Green"
        Case vbYellow
            WhatInteriorColor = "Yellow"
        Case vbBlue
            WhatInteriorColor = "Blue"
        Case vbMagenta
            WhatInteriorColor = "Magenta"
        Case vbCyan
            WhatInteriorColor = "Cyan"
        Case Else
            Select Case rng.Interior.ColorIndex
                Case 2
                    WhatInteriorColor = "White"
                Case xlColorIndexNone
                    WhatInteriorColor = "None"
                Case Else
                    WhatInteriorColor = "Other"
            End Select
    End Select
End Function

Back to Microsoft: Office FAQ Index
Back to Microsoft: Office Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close