Hello all,

I have a table with the columns: id, company and year, eg:
2 Dell 1996
2 Microsoft 1999
5 Apple 1997
5 Oracle 1999
5 Amazon 2000

I want to look in this table for a certain id and a certain year (some ids show up multiple times with multiple companies and years, I want hte first instance of an id and year match), and then print the company in the appropriate cell in another 2d table where the left column is just IDs and the row at the top is years.

1995 1996 1997 1998 1999 2000
2 Dell Microsoft
5 Apple Oracle Amazon
I have done this successfully using the following function, but now I also want it to return the color of the cell, not just its value.
---
Function PrintCompany(ID As Long, Year As Integer, cells As Range)
Dim Pos As Range, count As Integer
count = 1
Set Pos = cells(1, 1)
Do While (count <= cells.Rows.count)
PrintCompany = ""
If (ID = Pos.Value And Pos.Offset(0, 2).Value = Year) Then
PrintCompany = Pos.Offset(0, 1).Value
'ActiveCell.Interior.ColorIndex = pos.Offet(0, 1).Interior.ColorIndex <- not working
'currentcell.Interior.Color = pos.Offset(0, 1).Interior.Color <- not working
Exit Do
Else: PrintCompany = ""
End If
count = count + 1
Set Pos = cells(count, 1)

Loop

End Function

--------

I have tried calling a sub from the function to do just that but I don't know how to do it right. I have tried all sorts of other things to no avail. Any help would be appreciated.