Hi codeguru,
I have a color coded excel sheet that is every cell has a different color. How can I read the colors in vb.net. I appreciate any help.
Thanks,
raf35
Printable View
Hi codeguru,
I have a color coded excel sheet that is every cell has a different color. How can I read the colors in vb.net. I appreciate any help.
Thanks,
raf35
Here is a solution to use the color by using its index.
dim colorindex as integer
colorindex = ExcelSheet.Range("A1:A1").Interior.IolorIndex
Once you read the color index, you can change color in another cell by
ExcelSheet.cells(5,1).Interior.ColorIndex = colorindex
You can also check if another cell has this same color by
if colorindex = ExcelSheet.Cells(5,1).Interior.colorindex then
...
endif
I don't know how to convert color index to a color object in System.Drawing. Hope this will do what you want. Good Luck.