ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How can I modify the color of a cell? (https://www.excelbanter.com/excel-programming/287483-how-can-i-modify-color-cell.html)

James Prontier

How can I modify the color of a cell?
 
I am an Excel beginner, but learning a lot from the experts in this newsgroup. My problem is simple - I have two cells that I am monitoring. If cell 2 is larger in value than cell 1 (a1 < a2), then I need to "highlight" the the cell next to them in Red. If the A1 < A2 condition exists, I call a UserForm and will change the background color of that 3rd cell via an offset in the Userform. What I don't know how to do is change the background color. I would appreciate any help that can be offered. Thank you

JP

Bob Phillips[_6_]

How can I modify the color of a cell?
 
James,

Not sure how you will call the userform when A2A1, but to set a cell's
colour, just use

Range("A3").Interior.ColorIndex = 8

To see all of the standard colours, look up 'Colorindex Property' in VBA
Help.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"James Prontier" wrote in message
...
I am an Excel beginner, but learning a lot from the experts in this

newsgroup. My problem is simple - I have two cells that I am monitoring. If
cell 2 is larger in value than cell 1 (a1 < a2), then I need to "highlight"
the the cell next to them in Red. If the A1 < A2 condition exists, I call a
UserForm and will change the background color of that 3rd cell via an offset
in the Userform. What I don't know how to do is change the background color.
I would appreciate any help that can be offered. Thank you.

JP




Frank Haverkamp[_2_]

How can I modify the color of a cell?
 
Possibly this is what you are looking for.

Range("A1").Select
With Selection.Interior
..ColorIndex = 3
..Pattern = xlSolid
End With


---
Message posted from http://www.ExcelForum.com/


Ken Wright

How can I modify the color of a cell?
 
You might also want to check out Conditional Formatting for that part as opposed
to VBA. Might be a better option.

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------



"James Prontier" wrote in message
...
I am an Excel beginner, but learning a lot from the experts in this newsgroup.

My problem is simple - I have two cells that I am monitoring. If cell 2 is
larger in value than cell 1 (a1 < a2), then I need to "highlight" the the cell
next to them in Red. If the A1 < A2 condition exists, I call a UserForm and will
change the background color of that 3rd cell via an offset in the Userform. What
I don't know how to do is change the background color. I would appreciate any
help that can be offered. Thank you.

JP



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.560 / Virus Database: 352 - Release Date: 08/01/2004




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

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