ci should be the colorindex of the colour. For instance, Pink is 7, so for
instance you would use it like
=PinkHeading(4:4,7)
whic h will look for thr first pink cell in row 4, and return the value in
row 1 of that column. If your headings are in row 4, perhaps we should make
that optional, like this
Function PinkHeading(rng As Range, ci As Long, Optional headRow As Long = 1)
Dim cell As Range
Application.Volatile
For Each cell In rng
If cell.Interior.ColorIndex = ci Then
PinkHeading = Application.Caller.Parent _
.Cells(headRow, cell.Column).Value
Exit For
End If
Next cell
End Function
so you can pass the heading row, like
=PinkHeading(A16:M16,7,4)
--
HTH
Bob Phillips
(remove xxx from email address if mailing direct)
"manan" <(E-Mail Removed)> wrote in
message news:(E-Mail Removed)...
>
> hi bob
> Thanks for ur reply
> I am new to excel and not understanding the function.
> Though i did understand that the range would be teh selection of row.
> What should i selct for "ci". Is it the column heading selection. If it
> is the selection of column heading then the function is not returning me
> teh values.Instead showing error as VALUE
> Also my column headings are not in row 1 they are in row 4.
> Thanks
>
>
> --
> manan
> ------------------------------------------------------------------------
> manan's Profile:
http://www.excelforum.com/member.php...o&userid=34216
> View this thread: http://www.excelforum.com/showthread...hreadid=541059
>