Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Function to Return ColorIndex of Cell 1

Status
Not open for further replies.

krymat

Technical User
Jul 25, 2000
105
I'm looking for a function that returns the colorindex of a cell.
Something like =ReturnColor(A1)
if "A1" is red then return 3
 
Place the following function in a code module...

Function ReturnColor(cellName As String)
ReturnColor = Range(cellName).Interior.ColorIndex
End Function

You can then reference in a cell with...
=ReturnColor("A1")
 
Is there a way to return a cell address with a function, for example:
=ReturnCellAddress(A1) = "A1"
 
Function ReturnColor(RangeName)
For Each cell In RangeName
ReturnColor = Range(cell.Address).Interior.ColorIndex
Next cell
End Function

This is the exact function I wanted.
 
Good job, you get a star. s-) ----------------------------------------
If you are reading this, then you have read too far... :p

lightwarrior@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top