ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Fill Color? Background Color? (https://www.excelbanter.com/excel-programming/271221-fill-color-background-color.html)

andy[_4_]

Fill Color? Background Color?
 
I need to programatically change the background color of
a range of cells. Currently I can only change the font
color. I am using VB.Net 2003 with Library 9.0 for Excel
2k
Here is a very short snippet of what is causing me
trouble.
With WSRange (Excel.Range)
.Value = someArray (Same size as WSRange)
.Font.Color = color (hex number)
End With
but I cant do this:
WSRange.Font.BackGround = color (hex number)

Also setting the color gives me trouble. The default
VB.NET color settings for yellow shows up as a very
bright blue. I created some of my own with trial and
error, but where is the color listing?

Mark Bigelow

Fill Color? Background Color?
 
Instead of:

WSRange.Font.BackGround = color (hex number)

try:

WSRange.Interior.ColorIndex = (find the colorindexes in VBA help)

or

WSRange.Interior.Color = RGB(255, 0, 0) ' For red

Mark

---
Mark Bigelow
mjbigelow at hotmail dot com
http://hm.imperialoiltx.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


All times are GMT +1. The time now is 03:47 PM.

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