Associating Cell with Background Image
There is no easy way to do that. I think you would have to do some
intensive API work that identifies the color of the pixel on the screen,
then identifies which cell is at that pixel. Why not draw the circles using
the drawing toolbar.
--
Regards,
Tom Ogilvy
"ntegrat61" wrote in message
...
Can I make Excel relate a color in a picture to a cell?
First, I scanned into my computer hollow circles that were hand drawn.
Then, I filled them with red paint in Microsoft Paint. Then, I imported the
picture into Microsoft Excel two different ways: 1) to the background, and
2) to the
foreground.
I want to count every cell that contains red paint. I am using this VBA
function:
Function CountByColor(InputRange As Range, ColorRange as Range) As Long
Dim cl As Range, TempCount As Long, ColorIndex As Integer
ColorIndex = ColorRange.Cells(1, 1).Interior.ColorIndex
TempCount = 0
For Each cl In InputRange.Cells
If cl.Interior.ColorIndex = ColorIndex Then
TempCount = TempCount + 1
End If
Next cl
Set cl = Nothing
CountByColor = TempCount
End Function
However, Microsoft Excel recognizes every cell as being blank in both
cases. (That is, when the picture is in the background or foreground.) Can I
make Excel relate a color to a cell?
Michael
|