Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Color a Cell Based on a Range of Cells with Colors ron weasley Excel Worksheet Functions 1 January 13th 10 01:05 AM
How do you change the colors on the color palette bpaulik Excel Discussion (Misc queries) 0 April 7th 09 01:31 PM
Can I color one cell two colors? Gabrielle Excel Discussion (Misc queries) 5 December 31st 06 05:28 PM
Can I change the colors in the fill color chart? Genesis Pat Excel Discussion (Misc queries) 2 March 28th 06 07:51 PM
Excel color palette missing colors lstaley_corb Excel Discussion (Misc queries) 0 January 19th 05 10:53 PM


All times are GMT +1. The time now is 09:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"