×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• 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.

# 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...

#### CODE

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

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:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!