Solved

Extremely easy question.

Posted on 2004-09-30
2
213 Views
Last Modified: 2010-05-02
I am calculating ratings thru VB6.  I opened an excel worksheet, and as I am filling in the information, if a rating is higher than a target I want to fill that cells backcolor green, if lower, I want it to be red.  

I have been fighting this for a bit, and don't have the patience to look any longer.  Any help would be greatly appreciated.  Therefore, even though I know it is easy, I am giving 125 points instead of 50.

TIA,
DMM
0
Comment
Question by:dmmorse
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 32

Accepted Solution

by:
Erick37 earned 125 total points
ID: 12193107
A couple ways:

Sheet1.Range("A1:A1").Interior.Color = vbGreen
=or=
ActiveCell.Interior.Color = vbRed
0
 
LVL 5

Expert Comment

by:jmacmicking
ID: 12193554
Another option; Excel supports conditional formating.  If the target is fixed you can just set this for the whole column and let Excel do the grunt work.  The version of Excel I'm using (2002) has Conditional Formating listed under the Format menu.  If you've got an existing workbook just set it there and forget it.  If you're creating the workbook on the fly lemme know and I can lookup the appropriate object (or just use Erick37's suggestion, above)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question