Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Color a range with different colors
Hi,
I'd like to do something like this - int[,] colorMatrix = { { System.Drawing.Color.Yellow.To ToArgb(), System.Drawing.Color.Red.ToArgb() }, { System.Drawing.Color.Green.ToArgb(), System.Drawing.Color.Blue.ToArgb() } }; range = worksheet.get_Range(worksheet.Cells[1, 1], worksheet.Cells[2, 2]); range.Interior.Color = colorMatrix; But it doesn't work. Instead I just get one color in all cells. Is it possible to set a range with different colors? It works for text as follows - string[,] textMatrix = { { "A","B" }, { "C", "D" } }; range = worksheet.get_Range(worksheet.Cells[1, 1], worksheet.Cells[2, 2]); range.Value2 = textMatrix; The reason I wish to fill a range is that setting the value of a single cell is really slow when you do it for a large number of cells. As follows - for(int i = 1; i<=10000; i++) worksheet.Cells[i,1] = "A"; // really slow Any suggestions? Barry. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to Color a Cell Based on a Range of Cells with Colors | Excel Worksheet Functions | |||
How do you change the colors on the color palette | Excel Discussion (Misc queries) | |||
Can I color one cell two colors? | Excel Discussion (Misc queries) | |||
Can I change the colors in the fill color chart? | Excel Discussion (Misc queries) | |||
Excel color palette missing colors | Excel Discussion (Misc queries) |