ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   formatting background color of a cell with custom colors (https://www.excelbanter.com/excel-programming/345513-formatting-background-color-cell-custom-colors.html)

sprasad

formatting background color of a cell with custom colors
 
Hi,
How can we set the interior color of a cell with custom colors other than
color index values..like say i wan to set "#ccccff" this as background color
of cell.

Leith Ross[_281_]

formatting background color of a cell with custom colors
 

Hello sprasad,

Range("A1").Interior.Color = RGB( &HCC, &HCC, &HFF)

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=484771


Bob Phillips[_6_]

formatting background color of a cell with custom colors
 
That won't work, Excel will map the colour to the nearest colour on the
colour palette.

sprasad,

You will need to define new colours to the colour palette first before you
can use the new colour, such as

ActiveWorkbook.Colors(25) = RGB(&HCC, &HCC, &HFF)


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Leith Ross" wrote
in message ...

Hello sprasad,

Range("A1").Interior.Color = RGB( &HCC, &HCC, &HFF)

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile:

http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=484771




sprasad

formatting background color of a cell with custom colors
 
Hi,
Thanks for the response. I am trying do that in C#,it works in VB but not
in C# as there is no RGB available.I tried to use
System.Drawing.Color.fromArgb() but its giving type mismatch

"Bob Phillips" wrote:

That won't work, Excel will map the colour to the nearest colour on the
colour palette.

sprasad,

You will need to define new colours to the colour palette first before you
can use the new colour, such as

ActiveWorkbook.Colors(25) = RGB(&HCC, &HCC, &HFF)


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Leith Ross" wrote
in message ...

Hello sprasad,

Range("A1").Interior.Color = RGB( &HCC, &HCC, &HFF)

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile:

http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=484771





Bob Phillips[_6_]

formatting background color of a cell with custom colors
 
Sorry, I can't help with C#.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"sprasad" wrote in message
...
Hi,
Thanks for the response. I am trying do that in C#,it works in VB but

not
in C# as there is no RGB available.I tried to use
System.Drawing.Color.fromArgb() but its giving type mismatch

"Bob Phillips" wrote:

That won't work, Excel will map the colour to the nearest colour on the
colour palette.

sprasad,

You will need to define new colours to the colour palette first before

you
can use the new colour, such as

ActiveWorkbook.Colors(25) = RGB(&HCC, &HCC, &HFF)


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Leith Ross"

wrote
in message

...

Hello sprasad,

Range("A1").Interior.Color = RGB( &HCC, &HCC, &HFF)

Sincerely,
Leith Ross


--
Leith Ross


------------------------------------------------------------------------
Leith Ross's Profile:

http://www.excelforum.com/member.php...o&userid=18465
View this thread:

http://www.excelforum.com/showthread...hreadid=484771








All times are GMT +1. The time now is 01:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com