Function CellColor(r As Range)
    CellColor = Hex(r(1).Interior.Color)
End Function
E.g., =CellColor(A1)