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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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/

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 634
Default 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


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 do I override conditional format to modify color of 1 cell? kevpandrews Excel Discussion (Misc queries) 4 May 8th 23 11:45 AM
modify a standard color like in 2003 JeffTNDB Excel Discussion (Misc queries) 5 February 17th 08 12:12 AM
How can you modify the background color of a cell by using formul. Van Excel Worksheet Functions 1 August 16th 07 01:46 AM
Can I modify cell attributes (font,color etc.) based on function . TicklePig Excel Discussion (Misc queries) 4 December 4th 05 04:23 AM
Macro to Modify Pivot Table for Color and Bold Cheryl B. Excel Worksheet Functions 1 July 7th 05 03:52 PM


All times are GMT +1. The time now is 08:58 AM.

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"